Set the color of the Quantmod chartSeries line from green to another color.

Using version .string R version 2.11.0 (2010-04-22) quantmod "0.3-17"
Windows XP

When using the chartSeries function in quantmod with type="line" color of the line displayed on the chart is green. I would like to change the color from green to another color.

It looks like I can change the chartTheme , but the theme clearly does not have a variable to change the graph display color for the rows.

I can change the color of the string display when using the plot() function. So can you change the display of line graphs to a different color using chartSeries() in quantmod ?

+4
source share
1 answer

Instead of cluttering your argument list with options that control all aspects of the chart's appearance, chartSeries() has one theme argument. theme takes a chart.theme object, which controls the colors of most parts of the chart, linking all these color chart.theme to a single object.

The chartTheme() function creates chart.theme objects of the corresponding shape. Among the options listed in ?chartTheme , up.col seems to control the color you're asking for:

 require(quantmod) getSymbols("YHOO") chartSeries(YHOO, type="line", theme = chartTheme("black", up.col='gold')) 

enter image description here

+2
source

Source: https://habr.com/ru/post/1379795/


All Articles