![]() Library ( tidyquant ) library ( plotly ) tickers = c ( "GOOG", "AAPL", "AMZN", "FB", "NFLX", "MSFT" ) for ( i in tickers ) stock % add_trace ( x = ~ Dates, y = ~ GOOG, name = 'GOOG' ) %>% add_trace ( x = ~ Dates, y = ~ AAPL, name = 'AAPL' ) %>% add_trace ( x = ~ Dates, y = ~ AMZN, name = 'AMZN' ) %>% add_trace ( x = ~ Dates, y = ~ FB, name = 'FB' ) %>% add_trace ( x = ~ Dates, y = ~ NFLX, name = 'NFLX' ) %>% add_trace ( x = ~ Dates, y = ~ MSFT, name = 'MSFT' ) %>% layout ( title = 'custom tick labels with ticklabelmode="period"', legend = list ( title = list ( text = 'variable' )), xaxis = list ( dtick = "M1", tickformat = "%b\n%Y", ticklabelmode = "period" ), width = 1000 ) options ( warn = -1 ) fig % layout ( xaxis = list ( zerolinecolor = '#ffff', zerolinewidth = 2, gridcolor = 'ffff' ), yaxis = list ( zerolinecolor = '#ffff', zerolinewidth = 2, gridcolor = 'ffff' ), plot_bgcolor = '#e5ecf6' ) fig
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |