Custom x-axis label in quantmod chartSeries
This isn't a reproducible example--we don't have the stocks data frame. Also, it is bad practice to use dplyr in the R/Finance stack as it overrides multiple functions, such as lag and filter. On Mon, Feb 2, 2026 at 8:39?AM Andre Luiz Tietbohl Ramos <
andreltramos at gmail.com> wrote:
Hello,
Is it possible to customize the x-axis label? Using ggplot I have the
custom x-label described below,
stocks %>%
ggplot(aes(x = date, y = cum_ret)) +
theme_gray() +
theme(plot.background = element_rect(fill = "gray86")) +
geom_line(color = "blue") +
*theme(axis.text.x = element_text(angle = 50, hjust = 1))* +
labs(x = 'Data',
y = 'Cumulative Return',
title = paste0('Portfolio Cumulative Return of ',
length(tickers.clean), ' stocks on ',
format(as.Date(end), format="%d/%m/%Y")),
subtitle = paste0("Ativos: ", toString(tickers.clean), "\nWeights:
",
toString(percent(wts, accuracy = 0.1)))
) +
* scale_x_date(date_breaks = '2 weeks',
date_labels = '%d %b %y') + scale_y_continuous( breaks = seq(0,
10, 0.05), labels = scales::percent_format(accuracy = 1)*
)
TIA,
--
Andre Luiz Tietbohl Ramos, PhD
[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.