How to make a polar pcolor plot (with loglog axes)?

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

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?
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.

Sign in to comment.

Answers (1)

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

Thank you for the answers.
It wasn't a cylindrical plot but a 2D plot.
Here's how i finally did. I simply took log(r) and put zero at my lowest value (r=r-r(1)) to solve the negative value problem and plot from the origin and then made the pcolor plot. And then I just changed the ticks and tick labels accordingly.
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.
Yes, actually, what I did was to take log_r=log(r)-min(log(r)). By using log_r instead of r I can plot log scale in all four quadrants.

Sign in to comment.

Asked:

on 20 Jan 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!