简体   繁体   English

python散景地平线设置y尺度

[英]python bokeh horizon setting y-scale

Note from maintainers: This question concerns the obsolete bokeh.charts API that was removed several years ago.维护者注意:这个问题涉及几年前删除的过时的bokeh.charts API。 For information about about plotting with modern Bokeh (including stacked areas), see:有关使用现代散景(包括堆叠区域)绘图的信息,请参阅:

https://docs.bokeh.org/en/latest/docs/user_guide/plotting.html 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.可以显示如何更改 y 轴的比例以防止图形重叠。 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.我试图改变 plot_height 参数,但它只在垂直方向拉伸图形。

尝试将 num_folds=1 作为附加参数传递给 Horizo​​n()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM