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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:32:42+00:00 2026-06-06T01:32:42+00:00

I have the dataframe p3 below: test result 1 1 26.87778 2 1 24.52598

  • 0

I have the dataframe p3 below:

         test     result
    1      1    26.87778
    2      1    24.52598
    3      1    24.02202
    4      1    20.32632
    5      1    22.00618
    6      2    19.84013
    7      2    19.68983
    8      2    19.84013
    9      2    19.23892
    10     2    19.23892
    11     3    34.36430
    12     3    33.28196
    13     3    33.82313
    14     3    33.82313
    15     3    32.47020
    16     4    25.55169
    17     4    26.90442
    18     4    25.40138
    19     4    24.19895
    20     4    25.85230
    21     4    25.70199
    22     4    24.95047
    23     5    18.64646
    24     5    18.64646
    25     5    17.80653
    26     5    18.64646
    27     5    18.31049

I am trying to make a barchart with dodged results using the code:

    ggplot(p3, aes(x = test, y = result))+ geom_bar(position="dodge", stat="identity")

but it doesn’t work at all. I don’t understand why it is not working since I used the same code before and it worked.

  • 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-06T01:32:44+00:00Added an answer on June 6, 2026 at 1:32 am

    This was answered by Dennis Murphy:

    p3$test <- factor(p3$test)
    p3$fac <- factor(unlist(sapply(as.vector(table(p3$test)), seq_len)))
    ggplot(p3, aes(x = test, y = result, fill = fac)) + 
          geom_bar(position = 'dodge', stat = 'identity')
    

    Adjusting the variables:

    ggplot(p3, aes(x = test, y = result, color = fac, fill = test)) +
        geom_bar(position = 'dodge', stat = 'identity', linetype = 0)
    

    I almost got what I wanted, except that the color (outline) should be the same. but it was close enough.

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

Sidebar

Related Questions

I have the data below saved as a pandas dataframe . With this data,
I have a dataframe with numeric entries like this one test <- data.frame(x =
I have a dataframe like below and i want to add 4 letter (CATG)
I have a dataframe like the one below: obj date colour measurement A 01
I have a dataframe as shown below listing the number of injuries by vehicle
I'm have a dataframe as like below. I need to graph based on region,
I have a dataframe similar to the one generated below. Some individuals have more
I have a dataframe with test values of 20 different teststeps from some units
I have a Pandas Dataframe as below: itm Date Amount 67 420 2012-09-30 00:00:00
I have a data frame like below (20,000 rows by 49 cols). Each row

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.