Get the facecolor of a contourf plot
34 views (last 30 days)
Show older comments
I would like to find the facecolor of the the contourf patches. For example if :
[X,Y,Z] = peaks;
figure
contourf(X,Y,Z,4)
I would like to get the 5 different facecolors of the patches of the contour.
Thank you
0 Comments
Answers (1)
Doug Hull
on 11 Mar 2014
[X,Y,Z] = peaks;
[l, h] = contourf(X,Y,Z,4)
hp = get(h,'children')
get(hp,'cdata')
colorbar
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 Comments
Johannes Korsawe
on 26 Jan 2015
Kelly, is there some undocumented chance for some magic to set some FaceAlpha-Values for the plotted areas of the contourf-command?
See Also
Categories
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!