MATLAB Answers

How do I vary the color along a line in polar coordinates?

6 views (last 30 days)
For the example shown below, how do you vary the color of the plot based on the value of the data point. Basically, I'm looking for a good way to show which values are negative and which are positive (a gradual transition in color would be preferable) since this is not immediately obvious on a polar plot. Perhaps something similar to https://www.mathworks.com/matlabcentral/answers/5042-how-do-i-vary-color-along-a-2d-line but for polar coordinates
Theta = 0:0.1:2*pi;
Sin_Theta = sin(Theta);
figure
polarplot(Theta,Sin_Theta)

Accepted Answer

Walter Roberson
Walter Roberson on 10 Jan 2019
Edited: Walter Roberson on 10 Jan 2019
just as is the case for primitive chart line objects , any one line produced by a polarplot call can only be a single colour .
I would have to research adding aa patch or surface object to a polar axes. My memory at the moment is that doing so at least used to be blocked.
  1 Comment
Walter Roberson
Walter Roberson on 10 Jan 2019
I confirm that patch, surface, and image cannot be added to polaraxes -- which rules out most of the ways normally used to produce colored lines.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!