braverock / PerformanceAnalytics

207 stars 105 forks source link

ylog parameter does not seem to work in charts.PerformanceSummary #184

Closed SwissMontainsBear closed 1 year ago

SwissMontainsBear commented 1 year ago

Description

I was using v1.1.0 of PerformanceAnalytics to produce documents. ylog parameter worked well in this version

When updating to recent versions of PerformanceAnalytics, ylog = TRUE does not seem to work anymore.

Expected behavior

I would expect the y axis to have a logarithmic scale.

Minimal, reproducible example

library('PerformanceAnalytics')
library('RColorBrewer')
library('xtable')

df = read.csv('Montly_Returns.csv')
monthly.ret = xts(df[,2:5], as.Date(df[,1]))
colorset=c(brewer.pal(9,"Blues")[7],brewer.pal(8,"Reds")[c(5)],brewer.pal(8,"Greens")[c(5)],brewer.pal(8,"YlOrRd")[c(3)])
charts.PerformanceSummary(monthly.ret, colorset=colorset, ylog = TRUE)

Session Info

R version 4.3.0 (2023-04-21)
Platform: aarch64-apple-darwin22.4.0 (64-bit)
Running under: macOS Ventura 13.4

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /opt/homebrew/Cellar/r/4.3.0_1/lib/R/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Zurich
tzcode source: internal

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

other attached packages:
[1] xtable_1.8-4               RColorBrewer_1.1-3        
[3] PerformanceAnalytics_2.0.4 xts_0.13.1                
[5] zoo_1.8-12                

loaded via a namespace (and not attached):
[1] compiler_4.3.0  tools_4.3.0     rstudioapi_0.14 curl_5.0.1     
[5] quantmod_0.4.22 grid_4.3.0      TTR_0.24.3      lattice_0.21-8 
[9] quadprog_1.5-8 

PerfAnalytics_1.1.0.pdf PerfAnalytics_2.0.4.pdf Montly_Returns.csv

joshuaulrich commented 1 year ago

This is likely caused by https://github.com/joshuaulrich/xts/issues/103. I started working on it, but got pulled away and haven't gotten back to it. It's on this branch https://github.com/joshuaulrich/xts/tree/103-plot-ylog. It would be a big change to plot.xts() so it would need a lot of testing to make sure it doesn't break anything.

SwissMontainsBear commented 1 year ago

Thank you for looking into it. I will have a look at the branch you are pointing to. Thanks again.