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

moved col length checks to cover multi.panel = T as well as being num… #424

Merged
merged 5 commits into from
Aug 6, 2024

Conversation

ethanbsmith
Copy link
Contributor

moved input length checks up in flow to cover both (multi.panel == TRUE) and (is.numeric(multi.panel))
fixes #423

@ethanbsmith
Copy link
Contributor Author

tbh, im not sure if we even need to check for mlti.panel. is there any harm in just doing this recycling for all scenarios?

ethanbsmith and others added 2 commits July 28, 2024 13:01
@joshuaulrich
Copy link
Owner

Thanks for the PR! I just added a commit that removed some later checks on the length of 'col', 'lty', and 'lwd' so they're only in one place in plot.xts() and one place in chart.lines(). Can you test this to make sure that didn't break anything? Thanks!

@ethanbsmith
Copy link
Contributor Author

hmm, im getting an error in addEventLines now. need to drill into this to isolate the issues

@joshuaulrich
Copy link
Owner

Can you give me an example so I can take a look too?

@ethanbsmith
Copy link
Contributor Author

ethanbsmith commented Aug 5, 2024

x <- as.xts(sample_matrix)
plot(x, multi.panel = TRUE)
addEventLines(xts("a", index(x)[10]), pos = 2:3)

seems to only be drawing on pos = 4
there seems to be a very similar variant of parameter recycling going on at the beginning of this function., but using times, not length,out

@joshuaulrich
Copy link
Owner

joshuaulrich commented Aug 5, 2024

That's a bug, but not related to these changes. It's in the prior version on CRAN (0.14.0).

EDIT:

Actually, it's a bug in the example in the documentation. There's no 'pos' argument to addEventLines(). You can do what you want with the 'on' argument.

     library(xts)
     data(sample_matrix)
     sample.xts <- as.xts(sample_matrix)
     events <- xts(letters[1:3], 
                   as.Date(c("2007-01-12", "2007-04-22", "2007-06-13")))
     plot(sample.xts[,4])
     addEventLines(events, srt = 90, pos = 2)

@ethanbsmith
Copy link
Contributor Author

sry, should be addEventLines(xts("a", index(x)[10]), on = 2:3)
thats the error im seeing

@ethanbsmith
Copy link
Contributor Author

working fine. all issues were on my end

@joshuaulrich joshuaulrich merged commit 3086e14 into joshuaulrich:main Aug 6, 2024
1 check passed
@joshuaulrich joshuaulrich added this to the 0.14.1 milestone Aug 6, 2024
@ethanbsmith ethanbsmith deleted the 423_recycle_col_input branch August 6, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plot.xts doesn't plot more than 8 columns properly on multi.panel = T
2 participants