How to redraw the current saved histogram "fig" file
4 views (last 30 days)
Show older comments
Hello,
I currently have the saved "fig" file generated by Matlab by using the default histogram "bin" size as I do not know what the histogram plot output would be.
For example:
Histogram_Plot=histogram(Histogram_Inputt_Plot_data);
savefig('Histogram_Plot.fig')
Since I got the saved "Histogram_Plot.fig" file, now I want to redraw the histogram using different bin. How can I extract the data or manupulate from the existing saved fig file and redraw with different bin size now that I got the data from the saved fig file. The reason I want to do this because I do not want to rerun the simulation again and I want use the data I already got from the saved fig file.
Thanks,
Charles
0 Comments
Answers (1)
Kevin Rawson
on 14 Apr 2019
Provided only the histogram is in the figure, the following should work:
hFig = open('Histogram_Plot.fig');
hAxes = hFig.Children;
hHist = hAxes.Children;
hHist.BinEdges = [ <your new bins here> ];
If you have additional lines in the figure (i.e. the figure axes have multiple children), you'll have to ensure you get the correct handle of your histogram.
0 Comments
See Also
Categories
Find more on Histograms 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!