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

  • Home
  • SEARCH
  • 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 7069817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:29:31+00:00 2026-05-28T05:29:31+00:00

I have a data frame which can be generated with: a <- c(rep(w,3), rep(x,3),

  • 0

I have a data frame which can be generated with:

a <- c(rep("w",3), rep("x",3), rep("y",3), rep("z",3))
b <- rnorm(12)
c <- c(rep(rnorm(1), 3), rep(rnorm(1), 3),rep(rnorm(1), 3),rep(rnorm(1), 3))
d <- c(1,1,1,2,2,2,1,1,1,2,2,2)
test <- data.frame(a,b,c,d)

I want to generate boxplots for the “b” column, and on each boxplot show the value of the c column – which is a sort of reference value for each “a” (hence the repetitions). I am almost there with the following, which also shows how I want the data displayed (facet):

library(ggplot2)
p <- ggplot(test) 
p <- p + geom_boxplot(aes(a, b)) 
p <- p + geom_point(aes(a, c), colour="red", shape=4, size=4)
p <- p + facet_grid(. ~ d, , scales="free_x")
p

The only problem with this approach is that there are really 3 geom_points (on top of each other) for every “a” value – how do I remove this inefficiency? I just want one geom_point.

Many Thanks

  • 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-05-28T05:29:31+00:00Added an answer on May 28, 2026 at 5:29 am

    I think you just want to use the unique values as a separate data frame passed to geom_point:

    p <- p + geom_point(data = unique(test[,c('a','c','d')]),
                        aes(a, c), colour="red", shape=4, size=4)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

R: how can I populate the rows of a data frame, in which each
I have a data.frame called series_to_plot.df which I created by combining a number of
I have a data.frame with 2 columns: Node A, Node B. Each entry in
I have a data frame with two columns. First column contains categories such as
I have a data frame where one particular column has a set of specific
I have a data frame, and I want to do some calculation with existing
SQLDF newbie here. I have a data frame which has about 15,000 rows and
I have a data frame with 3 variables, which are all wind speeds. I
A categorical variable V1 in a data frame D1 can have values represented by
I have a data.frame which has multiple columns. One of the columns is time

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.