Custom x-axis label in quantmod chartSeries
Andre, I am saying that those of us that aren't *you* cannot run your code because we don't know how you formulated the "stocks" object. Your code is not reproducible to anybody else. Please include a minimum *reproducible* example. -Ilya On Mon, Feb 2, 2026 at 12:41?PM Andre Luiz Tietbohl Ramos <
andreltramos at gmail.com> wrote:
Dear Ilya, Thanks for the prompt reply! The code from my previous message works and I uploaded as an example so you could see what my intent is. Your suggestion will be considered, thank you! Its output is attached (which is in Portuguese). Thanks, -- Andr? Luiz Tietbohl Ramos, PhD On Mon, Feb 2, 2026 at 12:56?PM Ilya Kipnis <ilya.kipnis at gmail.com> wrote:
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.