# Colormap Grid

17 views (last 30 days)
An on 30 Nov 2011
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

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);
An on 1 Dec 2011
thank you

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.
An on 1 Dec 2011
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