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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:07:41+00:00 2026-06-18T00:07:41+00:00

I have a dataset (test) as given below: Type Met1 Met2 Met3 Met4 TypeA

  • 0

I have a dataset (test) as given below:

Type    Met1    Met2    Met3    Met4
TypeA   65  43  97  77
TypeA   46  25  76  77
TypeA   44  23  55  46
TypeA   46  44  55  77
TypeA   33  22  55  54
TypeB   66  8   66  47
TypeB   55  76  66  65
TypeB   55  77  88  46
TypeB   36  67  55  44
TypeB   67  55  76  65

I have checked a lot of links on box plots, but I still have not succeeded for the type of box plot I want. I wish to have a boxplot with my X-axis having type A (yellow, orange) for all the Mets (Met1, Met2, Met3, Met4). In essence, I want something like the following (taken from here):

enter image description here

I am trying somethings like,

boxplot(formula = len ~ Type , data = test, subset == "TypeA")
boxplot(formula = len ~ Type , data = test, subset == "TypeA", add=TRUE)
Legend(legend = c( "typeA", "typeB" ), fill = c( "yellow", "orange" ) )

But I am not able to work it out with any of it. Can anyone help me know how do I make such box plots on my test data in the corrected way?

  • 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-18T00:07:42+00:00Added an answer on June 18, 2026 at 12:07 am

    A solution with ggplot2.

    First, transform your data frame test to the long format using melt:

    library(reshape2)
    test.m <- melt(test)
    

    Plot the data:

    library(ggplot2)
    ggplot(test.m, aes(x = variable, y = value, fill = Type)) +
      geom_boxplot() +
      scale_fill_manual(values = c("yellow", "orange"))
    

    enter image description here

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

Sidebar

Related Questions

I have a dataset and I want to test to see how close it
Another ggplot legend question! I have a dataset of the form test <- data.frame(
I have a dataset including 100 numbers. And I have a test number. My
Suppose I have a dataset: test = data.frame(x=c(1:11), y=as.character(c(1:11))) where the collumn 'y' is
I have DataSet which has 3 columns. Name - insurance comp. name - treatmentDate
I have a dataset with ~20M rows and I'm observing the following behavior. The
I have a DataSet , where in the first table and in the row
I have a dataset that i am trying to set the default value as
I have a dataset with one datatable. Now I want to set a filter
I have following dataset: name1 <- c(P1, P2, IndA, IndB, IndC, IndD, IndE, IndF,

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.