2 different colormaps and colorbars for 2 different dataset of points in 2D coordinate system

9 次查看(过去 30 天)
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 个评论
Adam
Adam 2017-6-20
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.
Gustav Essunger
Gustav Essunger 2017-6-20
I mean the same axes and I have Matlab 2013b. Yes two different colorbars, one for each dataset (e.g. one in 'gray' and one in 'cool')

请先登录,再进行评论。

回答(1 个)

KSSV
KSSV 2017-6-20
  5 个评论
Julian Hapke
Julian Hapke 2017-6-20
"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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by