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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:58:52+00:00 2026-06-11T04:58:52+00:00

Im having a bunch of lengthy repetitive ggplot2 instructions throughout a file. So far

  • 0

Im having a bunch of lengthy repetitive ggplot2 instructions throughout a file. So far i’ve been using variables control preset values keeping graphs uniform, having the configuration in one spot (e.g. to change the color of all graphs).

What i’m really looking for is a good way to preset those instructions so i don’t have to write the statements all over. As an example, i define somewhere top in the file:

OPTAX=theme_text(angle=30, hjust=1, vjust=1, size=8)

Where the plot statements is, i use

P<-ggplot(
       data=MYDATA,
       aes(x=Topics, y=value, fill=variable)) +
       ....
       opts(axis.text.x=OPTAX)
)

I would like to avoid writing the axis.text.x=MYVAR part and write something like

... + opts(MYOPTS) + ...

or avoid the opts statement at all and write

... + ALLMYOPTS + ...

so all my options are predefined in one statement.

As a second thing it would be good to override the statement. Something like

opts(MYOPTS, axis.text.x=theme_text(angle=60)

would be great, so i can keep the preset but still use custom options.

  • 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-11T04:58:53+00:00Added an answer on June 11, 2026 at 4:58 am

    This will work:

    ALLMYOPTS <- opts(axis.text.x = theme_text(angle=30, hjust=1, vjust=1, size=8))
    P + ALLMYOPTS
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble using resource files. In my project I'm using a bunch
I've been having a bunch of exceptions when trying to use a WebBrowser on
My issue is quite simple: I'm having a bunch of unit tests using pymox.
Basically my task is having to sort a bunch of strings of variable length
I hate having a bunch of left/right methods. Every time a property is added
So I have an animation that is being created by having a bunch of
I have a bunch of unit tests (Test1, Test2, etc.), but rather than having
Having a hard time with labels on a ggplot2 plot. Here's a similar plot
Having trouble with an .htaccess file on WAMP. Works on the live server, but
Can anyone please help me? I am having bunch of .sql files. I want

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.