Colormap Grid
조회 수: 9 (최근 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
댓글 수: 0
답변 (2개)
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
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.
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Blue에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!