Filter löschen
Filter löschen

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

9 Ansichten (letzte 30 Tage)
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 Kommentare
Adam
Adam am 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.
Gustav Essunger
Gustav Essunger am 20 Jun. 2017
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')

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 20 Jun. 2017
  5 Kommentare
Julian Hapke
Julian Hapke am 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Colormaps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by