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 8964309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:33:32+00:00 2026-06-15T16:33:32+00:00

This code does not work as expected with ggplot2 0.9.3 (worked fine with earlier

  • 0

This code does not work as expected with ggplot2 0.9.3 (worked fine with earlier versions of ggplot2, See here). Is there a work-around for this problem?

library(ggplot2)
p <- qplot(as.factor(dose), len, data=ToothGrowth, geom = "boxplot", color = supp) + theme_bw()
p <- p + labs(x="Dose", y="Response")
p <- p + stat_summary(fun.y = mean, geom = "point", color = "blue", aes(group=supp))
p <- p + stat_summary(fun.y = mean, geom = "line", aes(group = supp))
p <- p  + theme(axis.title.x = element_text(size = 12, hjust = 0.54, vjust = 0))
p <- p  + theme(axis.title.y = element_text(size = 12, angle = 90,  vjust = 0.25))
print(p)

Edit

This line

p <- p + stat_summary(fun.y = mean, geom = "line", aes(group = supp))

produces the following warning

geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?

  • 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-15T16:33:33+00:00Added an answer on June 15, 2026 at 4:33 pm

    This behavior is a bug in ggplot2 0.9.3: https://github.com/hadley/ggplot2/issues/739

    You can work around it by calculating the summaries using ddply:

    library(plyr)
    tg <- ddply(ToothGrowth, c("dose", "supp"), summarise, len = mean(len))
    
    library(ggplot2)
    ggplot(ToothGrowth, aes(x=as.factor(dose), y=len, colour=supp)) +
        geom_boxplot() +
        geom_line(data=tg, aes(group=supp))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code, this does not work in Chrome, Safari, FF or Opera.
I wonder why this code does not work as expected: @ECHO off SET S1=HELLO
My jQuery code does not work as expected. Here is the HTML: <a href=>Some
I have this css code but does not work as expected. My aim is
I'm newbie in Python. I can't understand why this code does not work: reOptions
This javascript code does not work in IE8, but works in Firefox and Google
I have this piece of code that does not work: public CartaoCidadao() { InitializeComponent();
I dont get why this simple line of code does not work: <?php $someVariable
How can I do this? (The following code does NOT work, but I hope
This piece of code used to work in MVC 1 but it does not

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.