Creating Circular Image Plots with Transparency in MATLAB

Click For Summary

Discussion Overview

The discussion revolves around creating circular image plots with transparency in MATLAB, specifically focusing on how to manipulate a 500x500 matrix to achieve a desired visual effect. Participants explore various methods and challenges related to plotting techniques and transparency settings.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant seeks guidance on plotting a 500x500 matrix as a circular image without displaying anything outside the circular region.
  • Another participant suggests transforming x and y coordinates to polar coordinates for plotting, but does not clarify how this applies to the matrix directly.
  • A participant expresses confusion about applying the suggested method, noting that their matrix lacks explicit coordinates and that they are using pcolor with "EdgeAlpha" set to zero.
  • There are multiple requests for clarification and assistance, indicating ongoing difficulty in finding a solution.
  • A later reply indicates a resolution involving the use of alpha data to control transparency, specifically mentioning the use of ROI to manage which parts of the image remain opaque or become transparent.

Areas of Agreement / Disagreement

Participants generally express uncertainty and confusion about the plotting techniques, with no consensus reached on the best approach until the final post, which presents a potential solution regarding alpha data.

Contextual Notes

Participants mention limitations in understanding plotting tools and the need for specific visual outcomes, such as making non-circular areas white, which may depend on the implementation of transparency settings.

Who May Find This Useful

This discussion may be useful for MATLAB users interested in advanced plotting techniques, particularly those dealing with image matrices and transparency effects.

mikeph
Messages
1,229
Reaction score
18
Hi,

Just came across this as an image in a book/monograph and it looks very MATLAB-esque, except I cannot figure out how to possibly create a circular image

fig6.4r.jpg


Say I have a 500x500 matrix and want to plot it as a colour image in this way. Does anyone know how? I've been re-reading the same help files again and again with no progress.
 
Physics news on Phys.org
transform the x and y coordinates to polar coordinates and plot the new coordinates,
plot3(cos(x), sin(y));
 
Thanks for the reply, I don't fully understand how to apply it to my problem (never been strong on plot tools), my image has no coordinates, it's just a 500x500 matrix. I don't need the axis, just for the plotter to not plot anything outside a circular region. Currently I'm using pcolor with "EdgeAlpha" to zero so it looks very similar to that image I linked, but it's a square.
 
Hi, just need to bump this, I still don't understand how to do this.
 
One more bump, I still can't find an answer, thanks

I really just need to know how to make the non-circle area white, at the moment I'm fiddling around with colour maps and manually changing the values to force it to look white, but it has side-effects.
 
Last edited:
Bumping to say I solved the problem.

The solution lies in the alpha data of the object.

For example you can use a ROI to make part of the object transparent, using

set(gco,'AlphaDataMapping','scaled','AlphaData',ROI)

Where ROI = 1 the image will stay opaque and where it is 0 the image will be transparent.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K