필터 지우기
필터 지우기

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
Gustav Essunger
Gustav Essunger 2017년 6월 20일
Are you referring to a specific example? I still can't find it
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