1

I would like to know if i can increase the size of the bottom pane of the graph on the plot function chart_Series()

chart_Series(x$A, TA="add_TA(x$B)")

you don't need data to know what this will look like...this shows the output of the chart_Series function with TA

cdcaveman
  • 175
  • 1
  • 14

1 Answers1

1

It is possible to modify some aspects of chart_Series using the pars and theme objects you can optionally pass to chart_Series. But I don't know if there is a way to feed in modifying the size of the y axis in add_TA etc without directly modifying the source code for add_TA. This is what I've done before, which is a bit messy, but works ... modify the source code.

The line in add_TA you want to modify is this, which is hard coded as (approximatly line 61 of add_TA):

plot_object$add_frame(ylim = range(na.omit(xdata)), 
            asp = 1)

Changing that line to this (the value of asp (aspect?) is changed), will give you something like what you want:

plot_object$add_frame(ylim = range(na.omit(xdata)), 
                      asp = 3)

This change gives:

getSymbols("AAPL")
chart_Series(AAPL["2016"])
my_add_TA(SMA(AAPL["2016", 4]))  #my_add_TA is add_TA with asp line changed

enter image description here If you're unsure about how to modify the source code of a package, you could follow my answer to a related question here modify chart_Series source on modifying chart_Series as one approach. Another approach is just to recompile the source code for the package with your modifications.

Community
  • 1
  • 1
FXQuantTrader
  • 6,821
  • 3
  • 36
  • 67
  • Why not make it an argument passable to the add_TA() function... such that the asp value can be passed... – cdcaveman Jun 22 '16 at 06:01
  • Yep you can, if you carefully pass the argument into the environments used in add_TA. I don't think the author of this package is updating this package at the moment though (not for several years), so `chart_Series` and related are likely to stay in 'alpha' for some time. Just make your own edits to the source :D – FXQuantTrader Jun 22 '16 at 06:03