Borrar filtros
Borrar filtros

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

9 visualizaciones (últimos 30 días)
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 comentarios
Adam
Adam el 20 de Jun. de 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 el 20 de Jun. de 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')

Iniciar sesión para comentar.

Respuestas (1)

KSSV
KSSV el 20 de Jun. de 2017
  5 comentarios
Julian Hapke
Julian Hapke el 20 de Jun. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by