Colormap Grid
9 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Naz
on 30 Nov 2011
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 Comments
Naz
on 30 Nov 2011
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
on 1 Dec 2011
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.
See Also
Categories
Find more on Blue in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!