Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7903989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:52:58+00:00 2026-06-03T09:52:58+00:00

Some geom obscure the key to other geoms in the legend (notably, boxplot) How

  • 0

Some geom obscure the key to other geoms in the legend (notably, boxplot)

How can I choose which geom appears in the legend?

Eg.:

qplot(data=CO2,
      x=Type,
      y=uptake,
      colour=Plant,
      shape=Treatment)+
        geom_boxplot()

enter image description here

Switching the order of the geoms helps

qplot(data=CO2,
      x=Type,
      y=uptake,
      colour=Plant,
      shape=Treatment,
      geom="boxplot")+
        geom_point()

enter image description here

But I would like the legend found with:

qplot(data=CO2,
      x=Type,
      y=uptake,
      colour=Plant,
      shape=Treatment)

enter image description here

Do I need to extract the legend of one plot and paste it to the other using something like gridExtra?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:52:59+00:00Added an answer on June 3, 2026 at 9:52 am

    You can suppress the legend for the boxplot by adding show_guide=FALSE to the geom_boxplot() call. You still get the legend from the points.

    qplot(data=CO2,
          x=Type,
          y=uptake,
          colour=Plant,
          shape=Treatment)+
            geom_boxplot(show_guide=FALSE)
    

    enter image description here

    If you were not already plotting points (that is, just had boxplot, but wanted the legend to be shown with points symbol rather than the boxplot symbol), that is harder, though I think possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have some data which represents many model runs under different scenarios. For a
I have some data from the 2008 election, which I've aggregated in the hopes
I have some geographic x,y,z data which I plot as follows p<-ggplot(aes(x=x,y=y,fill=z),data=my_data) I then
It seems there is some padding around the title, which I can't figure out
Some setup background first: I have a cronjob which runs a PHP file called
I am graphing some data with ggplot. However, I don't understand the error I'm
I'm plotting some data using geom_smooth and looking for a way to change the
Can I use ggplot2 to produce a violin plot? Perhaps using some variation of
I have some data scraped and processed from the web in this form: >head(dat)
I am trying to display some information about the data below the plot created

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.