필터 지우기
필터 지우기

Plot a Colour Wheel scale

조회 수: 22 (최근 30일)
JMS
JMS 2014년 4월 8일
댓글: Image Analyst 2014년 4월 15일
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.

채택된 답변

Image Analyst
Image Analyst 2014년 4월 8일
See my attached demo. It does that.
  댓글 수: 3
Image Analyst
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
JMS
JMS 2014년 4월 10일
That is better and helps more.
Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Kelly Kearney
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
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
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 CenterFile Exchange에서 Red에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by