Get the facecolor of a contourf plot

조회 수: 26(최근 30일)
Giorgos Papakonstantinou
Giorgos Papakonstantinou 2014년 3월 10일
댓글: Johannes Korsawe 2015년 1월 26일
I would like to find the facecolor of the the contourf patches. For example if :
[X,Y,Z] = peaks;
I would like to get the 5 different facecolors of the patches of the contour.
Thank you


Doug Hull
Doug Hull 2014년 3월 11일
[X,Y,Z] = peaks;
[l, h] = contourf(X,Y,Z,4)
hp = get(h,'children')
This gets you the value of the cdata. Look at the colormap to get the actual RGB color. Look at the colorbar to see what those values correspond to.
  댓글 수: 5
Johannes Korsawe
Johannes Korsawe 2015년 1월 26일
Kelly, is there some undocumented chance for some magic to set some FaceAlpha-Values for the plotted areas of the contourf-command?

댓글을 달려면 로그인하십시오.


Find more on Contour Plots 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!

Translated by