1
在這裏,我採取了一些gapminder.org data,並通過多年來創建一系列圖表(其中我converted to an animated gif in imageio)通過修改Making Interactive Visualizations with Bokeh筆記本。Python Bokeh:如何保持y軸刻度線的穩定?
的問題是,當中東國家上浮到20世紀70年代前,y軸刻度線(和圖例)被幹擾。我讓儘可能多的事情儘量了一年循環,當我建的地塊,所以我的y軸的代碼如下所示:
# Personal income (GDP per capita)
y_low = int(math.floor(income_df.min().min()))
y_high = int(math.ceil(income_df.max().max()))
y_data_range = DataRange1d(y_low-0.5*y_low, 1000000*y_high)
# ...
for year in columns_list:
# ...
# Build the plot
plot = Plot(
# Children per woman (total fertility)
x_range=x_data_range,
# Personal income (GDP per capita)
y_range=y_data_range,
y_scale=LogScale(),
plot_width=800,
plot_height=400,
outline_line_color=None,
toolbar_location=None,
min_border=20,
)
# Build the axes
xaxis = LinearAxis(ticker=SingleIntervalTicker(interval=x_interval),
axis_label="Children per woman (total fertility)",
**AXIS_FORMATS)
yaxis = LogAxis(ticker=LogTicker(),
axis_label="Personal income (GDP per capita)",
**AXIS_FORMATS)
plot.add_layout(xaxis, 'below')
plot.add_layout(yaxis, 'left')
正如你所看到的,我碰到了數據範圍減少10^6倍,沒有效果。是否需要添加一些參數以保持我的y軸刻度線(和圖例)穩定?
問題解決了!謝謝。 –