Reputation: 128
Note from maintainers: This question concerns the obsolete bokeh.charts
API that was removed several years ago. For information about about plotting with modern Bokeh (including stacked areas), see:
https://docs.bokeh.org/en/latest/docs/user_guide/plotting.html
Hi I am doing a data visualization project which need to use bokeh Horizon to plot a graph of the price of stocks and I am new to this library. Can some show how to change scale of the y-axis to prevent the overlapping of graph. So here is my code to plot this graph
from bokeh.charts import Horizon, show, output_file
import pandas as pd
#stock data
NVDA=pd.read_csv('http://ichart.yahoo.com/table.csv?s=NVDA&a=0&b=1&c=2010&d=0&e=1&f=2018', parse_dates=['Date'])
AAPL=pd.read_csv('http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2010&d=0&e=1&f=2018', parse_dates=['Date'])
data={'NVDA':NVDA['Adj Close'],'Date':NVDA['Date'],'AAPL':AAPL['Adj Close']}
plot=Horizon(data, x='Date', title='Nvidia & Apple stock prices in recent 7 years', plot_width=800, plot_height=500)
output_file('bokeh.html')
show(plot)
The result shows like this
As you can see when the price go beyond the limit it will just overlap the original graph with a deeper color. I tried to change the plot_height parameter but it only stretch the graph in the vertical direction.
Upvotes: 0
Views: 501