2 different colormaps and colorbars for 2 different dataset of points in 2D coordinate system
4 views (last 30 days)
Show older comments
Hi all,
I've plotted 2 different datasets of points in a 2D coordinate system (same coordinate system) using scatter. My data is a 3 column matrix where first column is x-value and second column is y-value. I then want the different point to be different colors depending on the value in the third column. I can create easy while plotting with scatter and then adding a colorbar but then the 2 different datasets gets the same range of colors and the same colorbar.
How get 2 different color ranges and colorbars for the 2 different datasets in the same figure? I can get this in two different figures adding colormap('gray') in of of them and colormap('cool')in the other figure, but I would like to have this in the same figure.
2 Comments
Adam
on 20 Jun 2017
Do you really mean the same figure or the same axes? i.e. if you have a sufficiently recent Matlab (I forget which version off-hand, maybe around R2015) then putting different colourmaps on different axes within the same figure is trivial as colourmaps are now per axes rather than per figure.
If you actually mean the same axes then it is more complicated, especially if you want 2 colorbars with them.
Answers (1)
KSSV
on 20 Jun 2017
5 Comments
Julian Hapke
on 20 Jun 2017
"7. Example 5: Overlay Multiple Axes with Differing Colormaps in a Single Figure"
it's not the same axes, but one is visible so the, in your case scatter plots, appear to be in the same axes.
See Also
Categories
Find more on Colormaps 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!