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

No 'ylab' param in plot.xts #333

jaymon0703 opened this issue May 7, 2020 · 4 comments · Fixed by #334

No 'ylab' param in plot.xts #333

jaymon0703 opened this issue May 7, 2020 · 4 comments · Fixed by #334


Copy link

jaymon0703 commented May 7, 2020


plot.xts does not have nor does it pass a ylab argument. Sure i can use title() after the plot function is called, but just wondering if you think ylab should be native to plot.xts() as it is in plot()?

Expected behavior

A little y label appears magically next to the y-axis.

Minimal, reproducible example

getSymbols("SPY",src = 'yahoo')
plot.xts(SPY$SPY.Adjusted, ylab="SPY")

Session Info

> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 19.10

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/
LAPACK: /usr/lib/x86_64-linux-gnu/

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            

attached base packages:
[1] graphics  grDevices utils     datasets  stats     methods  
[7] base     

other attached packages:
[1] quantstrat_0.16.7          foreach_1.5.0             
[3] blotter_0.14.4             PerformanceAnalytics_2.0.4
[5] FinancialInstrument_1.3.1  quantmod_0.4.16.1         
[7] TTR_0.23-6                 xts_0.12-0                
[9] zoo_1.8-7                 

loaded via a namespace (and not attached):
 [1] quadprog_1.5-8   lattice_0.20-38  codetools_0.2-16
 [4] MASS_7.3-51.5    grid_3.6.2       curl_4.3        
 [7] boot_1.3-24      tools_3.6.2      iterators_1.0.12
[10] compiler_3.6.2  
Copy link

joshuaulrich commented May 9, 2020

I think it makes sense to include support for ylab. I'm sure you're not the only person who expected it, since it's exposed in plot() and plot.zoo().

I think we should also include support for sub and xlab. Though it may make sense that xlab throws a warning, since the x-axis is always time for xts objects.

It seems like this would be as simple as adding a title() call in chart.lines() if sub, xlab, or ylab are present in .... Thoughts?

Copy link
Contributor Author

jaymon0703 commented May 9, 2020

Copy link

joshuaulrich commented May 9, 2020

Would you be willing to work on a PR? Please take a look at the contributing guide before you get started.

Copy link
Contributor Author

jaymon0703 commented May 9, 2020

jaymon0703 added a commit to jaymon0703/xts that referenced this issue May 9, 2020
Few things worth mentioning:

1. Tried to do this in chart.lines() but ylab was not passing through
2. Need a solution for when multi.panel is not NULL, perhaps a character vector of ylab strings?
3. Needed the plot printed before i could add title() hence cs becomes plot(cs)

Simple test is add ylab argument to plot.xts()

See joshuaulrich#333
@joshuaulrich joshuaulrich added this to the 0.12-1 milestone Jul 12, 2020
@joshuaulrich joshuaulrich linked a pull request Aug 2, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

2 participants