How to modify titles on plots generated by controlchart(y, 'chart', {'i','mr'})
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
David O'Brien
am 24 Jun. 2015
Kommentiert: David O'Brien
am 30 Jun. 2015
controlchart() uses subplot to generate two charts. After I generated the plots, I realized that I can only change the last subplot and not the first one.
How can I change the titles and x/ylabels of each subplot?
(I think it has something to do with figure handles, but I can't quite figure it, no pun intended.)
0 Kommentare
Akzeptierte Antwort
Mukul Rao
am 25 Jun. 2015
Hi, based on your previous posts, I assume you are working with release R2015a. I would highly recommend spending some time to get acquainted with the graphics object system in MATLAB as it can really empower you to implement more complex workflows. Here are two links to help get you started :
http://www.mathworks.com/help/matlab/graphics-objects.html http://www.mathworks.com/help/matlab/creating_plots/graphics-objects.html
Based on the concepts associated with MATLAB Graphics Objects, you can change the titles of your subplots as shown below with the documented example for control chart.
%%Example from documentation for generating a control chart object
load parts
st = controlchart(runout,'chart',{'xbar' 'r'});
%%Modify this chart to add your own titles
%Get figure handle
figureHandle = gcf;
%Inspect the contents of the figure children
%Notice it contains two axes objects for each of the subplot and
%one legend object
figureHandle.Children
%Now get hold of the axes handles for the subplots
subplotHandle1 = figureHandle.Children(1);
subplotHandle2 = figureHandle.Children(3);
%Finally set the 'String' property associated with the Title text object
%inside the axes object, to your custom string
subplotHandle1.Title.String = 'My title 1';
subplotHandle2.Title.String = 'My title 2';
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Title finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!