Visualizing 1D data with Color.
32 views (last 30 days)
I have a vector which gives the speed of a rat over time. Could someone please help me how I can show this data with a "color map" or "color bar". Basically I want to show each data point with a color.
Kevin Moerman on 26 Apr 2016
Edited: Kevin Moerman on 26 Apr 2016
There are many different ways of doing this. It depends on how you want to visualize the data. E.g. as bars, as dots, as a 1xn surface, as a 1xn image.
If you want an image you could use the following for a vector "a":
a=rand(1,10); figure; imagesc(a); colormap(jet(numel(a))); colorbar;
Alternatively you could use the scatter function to plot as colored points. For the x coordinates you could use time and for y the speed and you can color the points according to speed e.g.:
n=10; t=1:n; a=rand(1,n); figure; scatter(t,a,50,a,'filled');colormap(jet(n)); colorbar;