Search code examples
matlabplotmatlab-figureboxplot

Adding details for each box plot using bplot function


I am using the function bplot. What I want to is add some details next to each box to explain what it represents. For example, the first box is daylight hours, the second box is data concerning stock rates, and so on.

Legend gives me the following output:

Image 1

I want this output (without the legend):

Image 2

How do I add these details to my plot?


Solution

  • The easiest thing to do is to manipulate XTicks and XTickLabels i.e. set XTicks from 1 to number of plots and XTickLabels to the labels you want.

    Example:

    %Sample data 
    X = randn(30,4);
    T = bplot(X,'points'); 
    %Adjustments
    set(gca,'XTick', 1:4, 'XTickLabel', {'Day Light', 'Stock Rate', 'foo', 'baz'});
    

    output