Skip to content

Commit

Permalink
Honor user-defined 'col' arg when type = 'h'
Browse files Browse the repository at this point in the history
plot.xts() would always color histograms using up.col and dn.col,
regardless of any value provided by the user. Check if the user
provided a value for col and use it, otherwise use the default
up/dn colors.

Fixes #210.
  • Loading branch information
joshuaulrich committed Dec 12, 2017
1 parent 692967f commit a395cf2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ chart.lines <- function(x,
xx <- current.xts_chob()
switch(type,
h={
colors <- ifelse(x[,1] < 0, dn.col, up.col)
if (hasArg("col")) {
colors <- col
} else {
colors <- ifelse(x[,1] < 0, dn.col, up.col)
}
lines(xx$Env$xycoords$x,x[,1],lwd=2,col=colors,lend=lend,lty=1,type="h",...)
},
p=, l=, b=, c=, o=, s=, S=, n={
Expand Down

0 comments on commit a395cf2

Please sign in to comment.