Boxplot group labels turning interpreter off + Displaying boxplot symbols.
Show older comments
Hi,
I have a large number of groups of data that I want to plot using boxplot. The labels contain signs like '_' followed by letters or numbers. '_' causes the letters and numbers appear as subscript due to latex interpreter being on. How can I turn of Latex interptreter for the labels?
Also, since boxplot might be new to some people I want the symbols, whiskers, box, mean and median, to be shown like a legend in the boxplot. Is there an easy way to do that?
Thank you in advance
Edit: I will post the code.
boxplot(predictions{1}.YPredicted1,predictions{1}.Sample)% predictions{1}.Ypredicted is a a column containing numbers and...
% predictions{1}.Sample contains the corresponding group names
set(gca,'FontSize',10,'XTickLabelRotation',90) % group names rotatedby 90°
%How do I turn ob latex interpreter?
%%
% looking for objects in the boxplot
L1 = findobj(gca,'Tag','Median');
L2 = findobj(gca,'Tag','Box');
L3 = findobj(gca,'Tag','Upper Whisker');
L4 = findobj(gca,'Tag','Outliers');
L5 = findobj(gca,'Tag','Mean');
%%
%using the objects write legends
legend([L1(1,1),L2(1,1),L3(1,1)],{'Median','25-75 Percentile','Data boundary'},'Location','Northwest','FontSize',14)
Running the last line leads to the following error:
Index in position 1 exceeds array bounds.
Error in ScriptName (line 34)
legend([L1(1,1),L2(1,1),L3(1,1)],{'Median','25-75 Percentile','Data
boundary'},'Location','Northwest','FontSize',14); %,L4(1,1)Outliers
Accepted Answer
More Answers (0)
Categories
Find more on Box 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!