r - Change of col argument throwing an error and how to store individual graphical parameters -


i'll try define companies colors , fonts etc plots we're doing. first question: how can store them without overwriting "normal" par settings? mean can store in "par-container" , give them each plot etc?

ok here defined colors:

graph_blue<-rgb(43/255, 71/255,153/255) graph_orange<-rgb(243/255, 112/255, 33/255) graph_background<-rgb(180/255, 226/255, 244/255) 

if plot(something, col=graph_blue) error:

error in axis(1, @ = xycoords$x, labels = false, col = "#bbbbbb", ...) :    formal argument "col" matched multiple actual arguments 

if par(col=graph_blue) , plot(something) works want. why that? need change works in first line of code? understand throws error since there multiple settings starting col , plot(something, col=graph_blue) overwrite of them , that's why axis isn't visible. there special col setting color line of chart?

edit: ok here's reproducible example:

getsymbols('spy', from='1998-01-01', to='2011-07-31', adjust=t)  graph_blue<-rgb(43/255, 71/255,153/255) graph_orange<-rgb(243/255, 112/255, 33/255) graph_background<-rgb(180/255, 226/255, 244/255)  par(col=graph_blue)  plot.xts(spy) #works great plot.xts(spy, col=graph_orange) #not since axes missing 

and first question if store these settings not directly in par() in variable pass plot function?

no there isn't special col setting color line of chart. should use par or modify code source of function , add case of bar.col or candle.col. don't know why types bar , candle , not lines? guess not have lot of parameters...

note can save old parameters of par every time change it.

op <- par(col=graph_blue) ... ## plot job par(op) ## retsore  

it easy hack function , add new col parameters lines. few lines change in function:

plot.xts.col <- function (old.parameters,lines.col='green', ...) { .....   ## change line add paremeter explicitly   plot(xycoords$x, xycoords$y, type = type, axes = false,     ann = false,col=lines.col, ...)   ## , last line since .xtsenv internal object  assign(".plot.xts", recordplot(), xts:::.xtsenv)  } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -