Plot a Colour Wheel scale
17 次查看(过去 30 天)
显示 更早的评论
Hello! Please, can anyone tell how I can plot a Colour Wheel scale from specific data?
For example, if I have a [y,z] = meshgrid(-5: .35: 5, -5: .35: 5); Or [y,z] = meshgrid(-2: .1: 2, -2: .1: 2);
I also have attached file for example. Thanks in advance.
0 个评论
采纳的回答
Image Analyst
2014-4-8
See my attached demo. It does that.
3 个评论
Image Analyst
2014-4-9
It's one of the images it plots. If you want to mask it by a circle to make it round instead of square, you can use code from the FAQ to do that: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F
更多回答(1 个)
Kelly Kearney
2014-4-9
A simpler way:
r = linspace(0,1,10);
theta = linspace(0, 2*pi, 100);
[rg, thg] = meshgrid(r,theta);
[x,y] = pol2cart(thg,rg);
pcolor(x,y,thg);
colormap(hsv);
shading flat;
axis equal;
20 个评论
Kelly Kearney
2014-4-15
Aaaaaah!
You've used the phrase "have the color wheel in RGB from the quiver plot data" several times now, and it remains just as meaningless as before.
Your quiver plot has absolutely nothing to do with a color wheel. You can create a pretty picture of a color wheel several ways (such as the examples ImageAnalyst and I gave) using Matlab. Or you could pull out a piece of paper and some crayons and draw one there. But it's still just a pretty picture, and it has no connection to your quiver plot data.
I gave an example of how to plot directional data by color, overlaid with a quiver plot, and then I drew a small wheel next to it as a guide. Is that even remotely close to what you're looking for?
Image Analyst
2014-4-15
(Sound of hand slapping forehead) Yeah, I'm pretty much baffled too, and about to give up. I don't even know that he has vector field data. He just takes a vector spanning a certain range in x and certain range in Y, calls meshgrid and calls that his vector field. It's totally made up/synthesized. JMS do you have any actual real world data?
It sounds like JMS wants to create a color wheel but instead of using the normal values and ranges required to produce one (like I did), he wants to use some special specified range (-2 to +2) for some unknown reason. OK, well, if you insist on doing that, then you're going to have to transform those into the range that is required, and then create the wheel picture. Of course that could all be wrong since I don't know what he wants.
Maybe he wants to create an image of the velocity according to the equations, and just simply apply a colormap to it:
% First create velocityImage from equations. Then:
imshow(velocityImage);
colormap('hsv');
colorbar;
You don't get a pretty perfect color wheel but what you do get is an image where the color corresponds to the magnitude of the velocity.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Red 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!