Ask Your Question
4

How can the x-axis label in the plot made using chartSeries be set to the original date in the dataframe?

asked 2023-05-23 16:22:19 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-05-23 16:43:02 +0000

lakamha gravatar image

To set the x-axis label in the plot made using chartSeries to the original date in the dataframe, use the following code:

chartSeries(df, TA = NULL, name = "My Plot", subset = NULL, theme = chartTheme("white"), type = "line", xlab = "Date", ylab = "Price")

The "xlab" argument sets the label for the x-axis, which in this case is set to "Date". By default, the x-axis in chartSeries is labeled with the index of the dataframe, but specifying the "xlab" argument with the string "Date" will change the label to the original date values in the dataframe.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-23 16:22:19 +0000

Seen: 12 times

Last updated: May 23 '23