How to change labels of contourf when I have no handles?
Show older comments
Hello Everybody,
I have a figure with contourf but lost the data of the figure. I would like to change the labels manually with
clabel(C,h, 'manual','Rotation',0);
but I have no handles C and h. Is it possible to get it somehow with gco or gca? Or can I extract the data and make a new plot? I would prefer option 1 though...
Thanks in advance and best regards
Jan
Answers (1)
Chad Greene
on 27 Jan 2015
If the contourf plot is the most recently-plotted object, using get(gca,...) should work. Try this:
contourf(peaks(20),10);
h = get(gca,'children');
C = get(h,'contourmatrix');
clabel(C,h,'rotation',0)
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!