How to make a polar pcolor plot (with loglog axes)?
Show older comments
I have a set of values, say:
r=[0.1 1 10 100 1000 10000 100000]; theta=0:10:180; z=r*cos(theta)';
Now I would like to make a polar plot that is color coded in z and with log in the radial direction.
I tried doing it by changing the coordinates to a cartesian coordinate system and using pcolor, but the problem then is to have a log-axis for negative values.
Anyone know how to do this? Either as a real polar plot or by manipulating the axes?
Thank you!
Cecilia
2 Comments
Image Analyst
on 20 Jan 2012
I know I've asked a hundred other persons but no one has ever answered. Why are you using the confusing and deceptive pcolor() function instead of, and in preference to, the straightforward and easy image() function?
Walter Roberson
on 20 Jan 2012
Cecelia, is this a cylindrical plot? Or is it a 2D polar plot in which z is the color indicator only?
MATLAB itself does not offer a direct cylindrical plot, but there are some file contributions for cylindrical plots.
Answers (1)
Walter Roberson
on 20 Jan 2012
0 votes
How much screen space do you want to allocate to the plot for r=0 to r=1 ? In log space, there would be a tick at 0.1, another at 0.01, a third at 0.001, a fourth at 0.0001... a 100th at 1E-100... a 300th tick at 1E-300... Each of the ticks representing equal log10 intervals.
log radius on a polar does not work unless you have an infinite plotting area available to you.
By the way, consider using cosd(theta) instead of cos(theta) if you are going to use that theta range. Also consider that your "*" operation is telling MATLAB to attempt to do a matrix multiplication of a 1 x 7 vector by a 19 x 1 vector.
3 Comments
Cecilia
on 22 Jan 2012
Walter Roberson
on 22 Jan 2012
I'm not sure if I caught the transform you did, but at the moment it does not look like it would preserve ratios properly. If you had used r = r ./ min(r) then that would preserve ratios properly for the log plot, provided that there were no negative values.
Cecilia
on 22 Jan 2012
Categories
Find more on Grid Lines, Tick Values, and Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!