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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:21:05+00:00 2026-06-14T16:21:05+00:00

I often prefer to use a light text on dark background colortheme in IDEs.

  • 0

I often prefer to use a light text on dark background colortheme in IDEs. When I plot something in R the default colorscheme for plots is black text/borders/points on white background. I was trying to change this by default, preferably for specific devices called from R by default (X11cairo, RStudioGD), while keeping the normal defaults for ‘output’ devices such as pdf and png.

My question is twofold: (1) How can I set default graphical parameters? and (2) Can I do this only for particular devices?

For example, I can easilly set the colorscheme in the current device with par:

par(
  bg = "black",
  col = "white",
  col.axis = "white",
  col.lab = "white",
  col.main = "white",
  col.sub = "white")

plot(1)

Creates the white on black plot as expected, and as expected resetting the device returns to defaults:

dev.off()
plot(1)

I tried putting the following in my .Rprofile:

graphics:::par(
  bg = "black",
  col = "white",
  col.axis = "white",
  col.lab = "white",
  col.main = "white",
  col.sub = "white")
graphics:::plot(1,type="n",xlab="",ylab="",axes=FALSE)
graphics:::text(1,1,"Plotting area")

Which works somewhat, except that it opens a plot window on startup which can be abit annoying and in RStudio it doesn’t open the RStudio device but an x11 window. Also if I close that window the parameters reset again. I would prefer to be able to have this “colorscheme” used by default every time I open a plotting window with in for example RStudio’s default device.

  • 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-14T16:21:06+00:00Added an answer on June 14, 2026 at 4:21 pm

    Graphics parameters last for the life of the device, that is why you see them reset when you close the graphics device and start a new plot.

    Probably the best approach for what you want to do is to write a wrapper function for the devices that you want to change the defaults on. This function would start the device of interest and set the default parameters for you. You can then set your function as the default device using options(device=mygrdevice) where mygrdevice is the custom function. Then if no device is open and you issue a plotting command your function will run, open the device and set the defaults. But if you open a different device such as pdf or png then the regular defaults will be in place.

    You could also use setHook to set a hook function to run when plotting, but checking on which device is current would probably be more work than it is worth. If a hook is available for when a plotting device starts, that might be a better option.

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

Sidebar

Related Questions

Q1. Why do people often prefer to use NoSQL over RDBMS for storing data
I often use this code pattern: while(true) { //do something if(<some condition>) { break;
Why do some people prefer to use .setCommandListener(this) over .setCommandListener(new CommandListener(){}) more often? In
Often, when restarting Django runserver, if I use the same port number, I get
Often we have to use some of the methods which don't return anything useful.
I often use the excellent find program in Bash to list files with certain
When constructing a std::string from a const char* , I often use the following
I'm making a Windows Phone 7 application and I'm a bit confused with dark/light
I use mod-rewrite very often and am looking for a shortcut. If I want
I often find myself writing a property that is evaluated lazily. Something like: if

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.