Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot(xts.object, col = ifelse()) not working in 0.14.1 #426

Closed
dnousias opened this issue Oct 29, 2024 · 3 comments · Fixed by #428
Closed

plot(xts.object, col = ifelse()) not working in 0.14.1 #426

dnousias opened this issue Oct 29, 2024 · 3 comments · Fixed by #428
Assignees

Comments

@dnousias
Copy link

dnousias commented Oct 29, 2024

Description

Upgrading to xts 0.14.1 doesn't allow xts plot where the col argument has a value for every row in the xts object. This works in xts version 0.14.0.

Minimal, reproducible example

n <- 1000
series <- rnorm(n)
datetimes <- seq(as.POSIXct("2017-03-27"), length.out = n, by = "days")

library(xts)
x <- xts(series, datetimes)
colors <- ifelse(x >=0 , "green", "red")
plot(x, col = colors, type = "h")

First, in xts version 0.14.1:

image

But in xts version 0.14.0:

image

@joshuaulrich
Copy link
Owner

Thanks for the report! This is a regression bug and will be fixed in the next release.

@joshuaulrich joshuaulrich changed the title Plot(xts.object, col = ifelse()): not working in R 4.4.1 plot(xts.object, col = ifelse()) not working in 0.14.1 Oct 29, 2024
@ethanbsmith
Copy link
Contributor

ethanbsmith commented Nov 1, 2024

did i break this w/ #423? u can assign to me

@joshuaulrich
Copy link
Owner

@ethanbsmith looks like it. It gives the expected result in the commit prior to the fix (6523b54) and is broken in the commit with the fix (3086e14).

joshuaulrich pushed a commit that referenced this issue Nov 3, 2024
Commit 3086e14 introduced a
regression. The prior behavior allowed every data point in the series
to have a different color, line type, and line width.

Fixes #426.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants