Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Circular image plot (MATLAB)

  1. Jul 27, 2011 #1

    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


    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.
  2. jcsd
  3. Jul 27, 2011 #2

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    transform the x and y coordinates to polar coordinates and plot the new coordinates,
    plot3(cos(x), sin(y));
  4. Jul 29, 2011 #3
    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.
  5. Nov 15, 2011 #4
    Hi, just need to bump this, I still don't understand how to do this.
  6. Apr 26, 2012 #5
    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: Apr 26, 2012
  7. Jun 5, 2012 #6
    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


    Where ROI = 1 the image will stay opaque and where it is 0 the image will be transparent.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook