Question about labels under each boxplot. (2024)

61 views (last 30 days)

Show older comments

Marcus Vinicius Pereira de Souza on 26 Feb 2012

  • Link

    Direct link to this question

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot

  • Link

    Direct link to this question

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot

Answered: Ankita on 8 Feb 2023

Dear all, I need to put labels under each boxplot. To do this, I'm using: boxplot([dados(:,1),dados(:,2)],'labels',{'bf\it{IDEB}_2_0_0_7'},{'\bfEfficiencies'}) Unfortunately, I don´t have sucess. Can someone help me? Best regards. Marcus Vinicius

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Answers (7)

Jiro Doke on 26 Feb 2012

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_38795

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_38795

Open in MATLAB Online

When you say you don't have success, I assume you're saying that the labels aren't being rendered with the bold/italics/subscript formatting.

Try this:

dados = rand(100,2);

boxplot(dados,'labels',{'\bf\it{IDEB}_2_0_0_7','\bf Efficiencies'})

h = findobj(gca, 'type', 'text');

set(h, 'Interpreter', 'tex');

1 Comment

Show -1 older commentsHide -1 older comments

Tom Cook on 21 Apr 2019

Direct link to this comment

https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#comment_696415

  • Link

    Direct link to this comment

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#comment_696415

Hi, I kinda have the same problem. And your solution jiro does not work for me (MATLAB R2017a)!

Why? How can I make it work?

Why is there no proper handle for the boxplot function like for any other plot function?!

Sign in to comment.

Oleg Komarov on 26 Feb 2012

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_38794

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_38794

Open in MATLAB Online

dados = rand(100,2)

boxplot(dados,'labels',{'\bf\it{IDEB}_2_0_0_7','\bf Efficiencies'})

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Marcus Vinicius Pereira de Souza on 26 Feb 2012

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_38797

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_38797

Dear Oleg, Thanks you very much for your attention. But, unfortunately, the labels aren't being rendered with the bold/italics/subscript formatting. Best wishes, Marcus Vinicius

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Marcus Vinicius Pereira de Souza on 26 Feb 2012

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_38799

Dear Jiro, Thanks you very much for your attention. How do I do so that the name IDEB_2007 does not sit so close to the x-axis? Best wishes, Marcus Vinicius

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Chathurika on 29 Aug 2013

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_95414

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_95414

Open in MATLAB Online

set boxplot labels bold and font size of 16...

boxplot(X,'labels',{'a','b','c'})

set(findobj(gca,'Type','text'),'FontSize',16,'fontweight','bold')

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Tyler on 26 Feb 2015

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_169467

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_169467

Open in MATLAB Online

This page helped solve my issues using boxplots. I will list out all the tweaks I wanted done to my boxplot in case it helps anyone else.

I found all the editable properties using:

get(gca)

h = findobj(gca, 'type', 'text');

get(h(1))

and so on.

Here is an example of my tweaks:

data = rand(100,1); %random data

% a label for each data point

labels = repmat({'group2','group3','group1','group3'}',25,1);

Label_size = 15;

%used grouporder to arange the order of the boxes

%the labels option let you rename the labels (from group1 to G1)

boxplot(data,labels,'grouporder',{'group1','group2','group3'},'label',{'G1','G2','G3'})

xlabel('Labels','FontSize',Label_size,'FontWeight','bold')

ylabel('Data','FontSize',Label_size,'FontWeight','bold')

title('Nice Boxplot','FontSize',Label_size,'FontWeight','bold')

h = findobj(gca, 'type', 'text');

% this alters Yticklabels [0 to 1]

set(gca,'FontSize',Label_size);

set(gca,'FontWeight','bold')

% this alters the group labels: G1, G2, G3

set(h,'FontSize',Label_size);

set(h,'Interpreter','tex');

set(h,'FontWeight','bold')

% this moves the groups labels and the Xlabel down to avoid overlap

for j=1:length(h)

set(h(j),'Position',get(h(j),'Position')+[0 -5 0]);

end

h2 = get(gca, 'XLabel');

set(h2,'Position',get(h2,'Position')+[0 -8 0]);

You can change almost anything about any of the text this way, just look up the text properties you want to change, for more information see: text-properties.

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Ankita on 8 Feb 2023

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_1166675

  • Link

    Direct link to this answer

    https://support.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot#answer_1166675

data = rand(100,1); %random data

% a label for each data point

labels = repmat({'group2','group3','group1','group3'}',25,1);

Label_size = 15;

%used grouporder to arange the order of the boxes

%the labels option let you rename the labels (from group1 to G1)

boxplot(data,labels,'grouporder',{'group1','group2','group3'},'label',{'G1','G2','G3'})

xlabel('Labels','FontSize',Label_size,'FontWeight','bold')

ylabel('Data','FontSize',Label_size,'FontWeight','bold')

title('Nice Boxplot','FontSize',Label_size,'FontWeight','bold')

h = findobj(gca, 'type', 'text');

% this alters Yticklabels [0 to 1]

set(gca,'FontSize',Label_size);

set(gca,'FontWeight','bold')

% this alters the group labels: G1, G2, G3

set(h,'FontSize',Label_size);

set(h,'Interpreter','tex');

set(h,'FontWeight','bold')

% this moves the groups labels and the Xlabel down to avoid overlap

for j=1:length(h)

set(h(j),'Position',get(h(j),'Position')+[0 -5 0]);

end

h2 = get(gca, 'XLabel');

set(h2,'Position',get(h2,'Position')+[0 -8 0]);

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

See Also

Categories

MATLABGraphicsFormatting and AnnotationLabels and AnnotationsAxis Labels

Find more on Axis Labels in Help Center and File Exchange

Tags

  • boxplot
  • label

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


Question about labels under each boxplot. (10)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

Question about labels under each boxplot. (2024)

FAQs

What do the labels mean in boxplot? ›

For a box plot, the labels can show the number of samples, the first quartile value, the third quartile value, the median value, the top and bottom whisker value, the minimum and maximum values, any outlier values, and the notch values.

What are the value labels in boxplot? ›

To label a box plot, you need to find the five number summary for the data set:
  • the minimum – the least value.
  • the lower quartile – the middle of the lower half of the data.
  • the median – the middle of the data set.
  • the upper quartile – the middle of the upper half of the data.

What are the labels in R boxplot? ›

Adding Labels

We can add labels using the xlab,ylab parameters in the boxplot() function. By using the main parameter, we can add heading to the plot. Notch parameter is used to make the plot more understandable.

How are box plots labeled? ›

A box and whisker plot—also called a box plot—displays the five-number summary of a set of data. The five-number summary is the minimum, first quartile, median, third quartile, and maximum.

How are means represented in Boxplots? ›

The vertical line that split the box in two is the median. Sometimes, the mean is also indicated by a dot or a cross on the box plot.

What function is used to add labels to a plot in R? ›

Use the title( ) function to add labels to a plot.

What does labels mean in R? ›

Introduction. Variable label is human readable description of the variable. R supports rather long variable names and these names can contain even spaces and punctuation but short variables names make coding easier. Variable label can give a nice, long description of variable.

What is boxplot distribution description? ›

A boxplot shows the distribution of values in a data set based on its five-number summary. The five-number summary is the minimum, first quartile, median, third quartile and maximum in a data set.

What are the markings in a boxplot? ›

The box mark summarizes one-dimensional distributions as boxplots. It is a composite mark consisting of a rule to represent the extreme values (not including outliers), a bar to represent the interquartile range (trimmed to the data), a tick to represent the median value, and a dot to represent any outliers.

What do the different parts of a boxplot mean? ›

Interpreting a box and whiskers

The first quartile (Q1) is greater than 25% of the data and less than the other 75%. The second quartile (Q2) sits in the middle, dividing the data in half. Q2 is also known as the median. The third quartile (Q3) is larger than 75% of the data, and smaller than the remaining 25%.

What do the dots on a boxplot represent? ›

In box plots, dots are outliers. This is not particular to Seaborn or any other tool; it is generical to visualization in statistics. The outliers are points that stay out of the interval [Q1-1.5*IQR; Q3+1.5*IQR] , with: Q1 = Quartile 1 (25th percentile)

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Madonna Wisozk

Last Updated:

Views: 6186

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Madonna Wisozk

Birthday: 2001-02-23

Address: 656 Gerhold Summit, Sidneyberg, FL 78179-2512

Phone: +6742282696652

Job: Customer Banking Liaison

Hobby: Flower arranging, Yo-yoing, Tai chi, Rowing, Macrame, Urban exploration, Knife making

Introduction: My name is Madonna Wisozk, I am a attractive, healthy, thoughtful, faithful, open, vivacious, zany person who loves writing and wants to share my knowledge and understanding with you.