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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:22:39+00:00 2026-05-17T02:22:39+00:00

I would like to create 10 plots that have different data, but the same

  • 0

I would like to create 10 plots that have different data, but the same optical appearance. As an example, I’d like to change the colour of the gridline for each plot. This could be done by adding

+ opts(panel.grid.major = theme_line(colour = "white")

to each plot definition. However, when I now decide to change background colour to let’s say “grey25”, I’d have to modify each plot individually. This seems like way too much work. 😉

So, I thought about doing something like

opt1 <- '+ opts(panel.grid.major = theme_line(colour = "white")'

and then define each plot like

pl_x <- pl_x + opt1
pl_y <- pl_y + opt1
...

Other options (margins, fonts, scales,…) could then be added to opt1.
However, that doesn’t work (error message when trying to print pl_x). Anybody maybe knows how to accomplish what I’d like to do?

I also played around with theme_set and theme_update, but that resulted in none off my plots working anymore unless I completely restarted R.

  • 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-17T02:22:40+00:00Added an answer on May 17, 2026 at 2:22 am

    You don’t have to add the + sign.

    opt <- opts(panel.grid.major = theme_line(colour = "white"))
    
    pl_x <- pl_x + opt
    

    Although this doesn’t work:

    opt <- opts(...) + scale_y_continuous(..)
    

    This does:

    opt <- opts(...)
    syc <- scale_y_continuous(...)
    pl_x <- pl_x + opt + syc
    

    And thanks to Hadley’s example, this works too:

    opt <- list(opts(...),scale_y_continuous(...))
    

    Note: Since version 0.9.2 opts has been replace by theme.

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

Sidebar

Related Questions

i would like create a array of structure which have a dynamic array :
I would like to create a c++ type that mimic the build-in type exactly.
I would like to create a class that runs something (a runnable) at regular
I would like to create a virtual host in apache2, but I want it
I have written a function that creates a barplot. I would like to save
I have a java application that streams raw data and draws real time plots
I have a time series(a csv file) data that looks like below. Each observation
I have monthly sales figures stored in separate sheets. I would like to create
I would like to make a series of plots using ggplot from multiple different
I would like to write a function that creates a plot of a set

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.