Colormap Grid

조회 수: 23 (최근 30일)
An
An 2011년 11월 30일
Hi, I am new user of MATLAB and especially new with graphic. I am working on a visualization project and need some ideas how to start. Basically, I am having data for a whole bunch of vectors and they are divided into rows. So say 1000 vectors then every 10 of them start on the same row. I am trying to figure out a way to plot a grid on the background of all these vectors. Each square containing the vector will have a certain color that relate to the magnitude of the vector. I already plot the vectors using quiver but do not know how to start with the grid and colormap. Sorry if i sound confusing because I kinda am. Thank you, An

답변 (2개)

Naz
Naz 2011년 11월 30일
I would make a 2D matrix with 1000 rows and 10 columns and the color in each of 1000*10 squares would represent the relative magnitude:
x=rand(10,10);
imagesc(x);
  댓글 수: 3
Naz
Naz 2011년 11월 30일
imagesc function is for image scale as far as I know, so it should normalize the matrix itself, however, you can normalize it yourself to make sure all is good.
The second question is not clear to me.
An
An 2011년 12월 1일
thank you

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


Image Analyst
Image Analyst 2011년 12월 1일
Just load your numbers into a rectangular 2D matrix. Offset the vectors to start at whatever row or column in the 2D matrix you want. You can then display it with image(), imshow(), or imagesc(). Use colormap if you need to to fix up the colors to what you want. To see grid lines you're going to have to replicate your vectors into several lines if you want a grid line between your rows to be a single line of pixels. For example one row goes to 8 rows and there is a single row of black (0) in between that row and the others so that you'll have black outlines around your main row. You'll also have to have a really big image, like 4000 rows or more otherwise you won't have black gridlines between your rows. That means you'll have to have it zoomed in because your monitor is probably not much more than 1000 lines. Write back if you need a demo.
  댓글 수: 1
An
An 2011년 12월 1일
Could you please help me with a demo. I currently have the x,y coordinate and also the magnitude of the vector.
really appreciate it

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

카테고리

Help CenterFile Exchange에서 Blue에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by