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 function does not accept "quarters" in tick options anymore #256

Closed
eniso-partners opened this Issue Jul 22, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@eniso-partners

eniso-partners commented Jul 22, 2018

In the new release the plot function sends an error when using "quarters" for the option majors.ticks or minor.ticks. I expect it to plot with a tick mark every quarter.

require(PerformanceAnalytics)
require(xts)
data(edhec)
plot(edhec, major.ticks = "quarters")
Error in match.arg(ticks.on, c("auto", tick.opts)) :
'arg' doit être un deauto”, “years”, “months”, “weeks”, “days”, “hours”, “minutes”, “seconds
@joshuaulrich

This comment has been minimized.

Show comment
Hide comment
@joshuaulrich

joshuaulrich Jul 27, 2018

Owner

Thanks for the report. Though this did not throw an error in v0.10-2, it doesn't appear to have worked correctly. For example:

library(xts)
data("sample_matrix")
x <- as.xts(sample_matrix, dateFormat = "Date")

axTicksByTime(x)
# Jan 02 2007 Jan 08 2007 Jan 15 2007 Jan 22 2007 Jan 29 2007 Feb 05 2007 Feb 12 2007 Feb 19 2007 
#           1           7          14          21          28          35          42          49 
# Feb 26 2007 Mar 05 2007 Mar 12 2007 Mar 19 2007 Mar 26 2007 Apr 02 2007 Apr 09 2007 Apr 16 2007 
#          56          63          70          77          84          91          98         105 
# Apr 23 2007 Apr 30 2007 May 07 2007 May 14 2007 May 21 2007 May 28 2007 Jun 04 2007 Jun 11 2007 
#         112         119         126         133         140         147         154         161 
# Jun 18 2007 Jun 25 2007 Jun 30 2007 
#         168         175         180 

axTicksByTime(x, "quarter")  # same as "auto"
# Jan 02 2007 Jan 08 2007 Jan 15 2007 Jan 22 2007 Jan 29 2007 Feb 05 2007 Feb 12 2007 Feb 19 2007 
#           1           7          14          21          28          35          42          49 
# Feb 26 2007 Mar 05 2007 Mar 12 2007 Mar 19 2007 Mar 26 2007 Apr 02 2007 Apr 09 2007 Apr 16 2007 
#          56          63          70          77          84          91          98         105 
# Apr 23 2007 Apr 30 2007 May 07 2007 May 14 2007 May 21 2007 May 28 2007 Jun 04 2007 Jun 11 2007 
#         112         119         126         133         140         147         154         161 
# Jun 18 2007 Jun 25 2007 Jun 30 2007 
#         168         175         180 
packageVersion("xts")
# [1] '0.10.2'
Owner

joshuaulrich commented Jul 27, 2018

Thanks for the report. Though this did not throw an error in v0.10-2, it doesn't appear to have worked correctly. For example:

library(xts)
data("sample_matrix")
x <- as.xts(sample_matrix, dateFormat = "Date")

axTicksByTime(x)
# Jan 02 2007 Jan 08 2007 Jan 15 2007 Jan 22 2007 Jan 29 2007 Feb 05 2007 Feb 12 2007 Feb 19 2007 
#           1           7          14          21          28          35          42          49 
# Feb 26 2007 Mar 05 2007 Mar 12 2007 Mar 19 2007 Mar 26 2007 Apr 02 2007 Apr 09 2007 Apr 16 2007 
#          56          63          70          77          84          91          98         105 
# Apr 23 2007 Apr 30 2007 May 07 2007 May 14 2007 May 21 2007 May 28 2007 Jun 04 2007 Jun 11 2007 
#         112         119         126         133         140         147         154         161 
# Jun 18 2007 Jun 25 2007 Jun 30 2007 
#         168         175         180 

axTicksByTime(x, "quarter")  # same as "auto"
# Jan 02 2007 Jan 08 2007 Jan 15 2007 Jan 22 2007 Jan 29 2007 Feb 05 2007 Feb 12 2007 Feb 19 2007 
#           1           7          14          21          28          35          42          49 
# Feb 26 2007 Mar 05 2007 Mar 12 2007 Mar 19 2007 Mar 26 2007 Apr 02 2007 Apr 09 2007 Apr 16 2007 
#          56          63          70          77          84          91          98         105 
# Apr 23 2007 Apr 30 2007 May 07 2007 May 14 2007 May 21 2007 May 28 2007 Jun 04 2007 Jun 11 2007 
#         112         119         126         133         140         147         154         161 
# Jun 18 2007 Jun 25 2007 Jun 30 2007 
#         168         175         180 
packageVersion("xts")
# [1] '0.10.2'
@eniso-partners

This comment has been minimized.

Show comment
Hide comment
@eniso-partners

eniso-partners Jul 30, 2018

Thank you for your prompt answer. I notice that I now use the version 0.11-0 of xts and your example above throws an error:

axTicksByTime(x, "quarter")
Error in match.arg(ticks.on, c("auto", tick.opts)) :
'arg' should be one of “auto”, “years”, “months”, “weeks”, “days”, “hours”, “minutes”, “seconds”

eniso-partners commented Jul 30, 2018

Thank you for your prompt answer. I notice that I now use the version 0.11-0 of xts and your example above throws an error:

axTicksByTime(x, "quarter")
Error in match.arg(ticks.on, c("auto", tick.opts)) :
'arg' should be one of “auto”, “years”, “months”, “weeks”, “days”, “hours”, “minutes”, “seconds”

@joshuaulrich joshuaulrich added this to the Release 0.11-1 milestone Jul 30, 2018

@joshuaulrich

This comment has been minimized.

Show comment
Hide comment
@joshuaulrich

joshuaulrich Aug 3, 2018

Owner

Yes, I confirm that it throws an error in 0.11-0. My comment was that the output in 0.10-2 was not correct. It returned weekly locations, not quarterly.

Owner

joshuaulrich commented Aug 3, 2018

Yes, I confirm that it throws an error in 0.11-0. My comment was that the output in 0.10-2 was not correct. It returned weekly locations, not quarterly.

joshuaulrich added a commit that referenced this issue Aug 24, 2018

Fix Windows test for quarters axis tick labels
It appears the Windows device doesn't plot the newline on the axis
label like the X11 device does. Fix the test to account for this
difference in axTicksByTime().

See #256.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment