R-beta: Color specifications -- simple 'bg' / 'fg' swapping -- proposal

Martin Maechler (maechler@stat.math.ethz.ch)
Mon, 30 Jun 1997 12:17:40 +0200


Date: Mon, 30 Jun 1997 12:17:40 +0200
Message-Id: <199706301017.MAA00651@sophie.ethz.ch>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-help@stat.math.ethz.ch
Subject: R-beta: Color specifications -- simple  'bg' / 'fg' swapping -- proposal

Consider the following example :

data(iris)
attach(iris)

par(bg = 'midnightblue', fg = 'yellow')
plot(Petal.Length, Petal.Width, main = "Fisher's iris data", sub = "3 kinds")
##>>> gives black axis labels and titles ...

## Currently, the plot I want is produced by

par(bg = 'midnightblue', fg = 'yellow', col.axis='yellow',
col.lab='yellow', col.main='yellow', col.sub='yellow')
plot(Petal.Length, Petal.Width, main = "Fisher's iris data", sub = "3 kinds")

--------------------------------------------
Why is this ?  --- R's extra flexibility in specifying colors ---

> x11()
> unlist(par(as.list(c("bg","fg",.Pars[ "col" == substr(.Pars,1,3)]))))
      bg       fg      col col.axis  col.lab col.main  col.sub 
 "white"  "black"  "black"  "black"  "black"  "black"  "black" 

I.e., this was that default


> par(col="blue")
> unlist(par(as.list(c("bg","fg",.Pars[ "col" == substr(.Pars,1,3)]))))
      bg       fg      col col.axis  col.lab col.main  col.sub 
 "white"  "black"   "blue"  "black"  "black"  "black"  "black" 
> par(col="black") # set it back

#-- Here I would have liked to change ALL the foreground colors :
			       --------------------------------
> par(fg="blue")
> unlist(par(as.list(c("bg","fg",.Pars[ "col" == substr(.Pars,1,3)]))))
      bg       fg      col col.axis  col.lab col.main  col.sub 
 "white"   "blue"   "blue"  "black"  "black"  "black"  "black" 


Only the 'col' has been changed, but not  col.axis, col.lab, ...
--------

Do we need another  'par' parameter  to do this,
or couldn't the semantics of  "fg" be changed such that
the example above works as I had expected?

Martin Maechler <maechler@stat.math.ethz.ch>		 <><
Seminar fuer Statistik, SOL G1
ETH (Federal Inst. Technology)	8092 Zurich	 SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1086
http://www.stat.math.ethz.ch/~maechler/



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=