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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:11:13+00:00 2026-06-04T00:11:13+00:00

I have a matrix of 12 columns, and I am using boxplot function in

  • 0

I have a matrix of 12 columns, and I am using boxplot function in R to plot the boxplot.

following commands are used:

pdf("data.pdf") 
data<-read.table("data1", header=T) 
boxplot(data, outline=F)
dev.off()

What I want, is to present the first three boxplots in red, green, and blue. while the next three in yellow, next three in orange and next three in purple.

How can I do this?

Thank you

  • 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-04T00:11:15+00:00Added an answer on June 4, 2026 at 12:11 am

    To get colours, you just need to pass a vector of colours to the boxplot function:

    ##Create some dummy data
    runif(10*12), ncol=12)
    ##Create a vector of 12 colours
    cols = rep(c("yellow", "orange", "purple"), each=3)
    cols = col=c("red", "green","blue",cols)
    
    ##Plot as normal
    boxplot(dd, col=cols)
    

    BTW, don’t load your data at every iteration of your for loop. Load it once:

    data <- read.table("data1", header=T) 
    pdf("data.pdf") 
    boxplot(data, outline=F)
    dev.off()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently have a nx3 matrix array. I want plot the three columns
I have the following distance matrix in csv format. http://palaeomath.palass.org/images/mds/T1.jpg Using PHP, how could
After using sapply(data, unlist), I have what I think is a matrix of vectors
I have a mathematical matrix class. It contains a member function which is used
I have created the following type using implicit type construction: open System type Matrix(sourceMatrix:double[,])
I have 2 columns of data imported from using textscan. The data looks like
I have some simple code that represents a graph using a square boolean matrix
I have a matrix with two columns. I want to calculate running 60-day correlation
I wish to extract rows and columns from a matrix using a single fancy
I am trying to create a Matrix class using c++. So far, I have

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.