Reputation: 2443
The "previous versions" problem is the same one stated in Updated Bokeh to 0.5.0, now plots all previous versions of graph in one window. I'm running this in iPython notebook; every time I rerun the cell the output html file shows all previous versions, plus the new one.
The other problem is that I can't specify the size and/or aspect ratio of the plot in the output file.
Here is the entire script:
x = [0.4, 0.6, 0.8, 0.5]
y = [0.8, 0.5, 0.8, 0.9]
import bokeh.plotting as bplt
bplt.output_file('output.html')
bplt.figure(tools="wheel_zoom", width=1000, height=3000)
bplt.hold()
bplt.circle(x, y, color='red',
line_color='black', fill_alpha = 0.8, size = 10,
title = 'Ternary plot', background_fill='#dddddd')
bplt.line(x=[0,0.5],y=[1,0.134])
bplt.line(x=[0.5,1],y=[0.134,1])
bplt.line(x=[1,0],y=[1,1])
bplt.show()
Whatever values I put for width and height, the output is always the same size and aspect ratio.
Upvotes: 2
Views: 472
Reputation: 34568
width
and height
had to be removed as options to set the plot's width and height from the glyph functions (like circle
, etc) because some glyphs also have width
and height
attributes of their own and there was a conflict. But, it probably should have been retained for the figure
call as aliases for plot_width
and plot_height
. I have added a ticket to restore these as aliases in figure
:
https://github.com/ContinuumIO/bokeh/issues/897
In the mean time, you can pass plot_width
and plot_height
to figure(...)
and it will size the plot the way you want.
If you want to clear the plotting.py
session state, reset_output()
was added in 0.5.1. Here is a full working script:
x = [0.4, 0.6, 0.8, 0.5]
y = [0.8, 0.5, 0.8, 0.9]
import bokeh.plotting as bplt
bplt.reset_output()
bplt.output_file('output.html')
bplt.figure(tools="wheel_zoom", plot_width=100, plot_height=300)
bplt.hold()
bplt.circle(x, y, color='red',
line_color='black', fill_alpha = 0.8, size = 10,
title = 'Ternary plot', background_fill='#dddddd')
bplt.line(x=[0,0.5],y=[1,0.134])
bplt.line(x=[0.5,1],y=[0.134,1])
bplt.line(x=[1,0],y=[1,1])
bplt.show()
Upvotes: 1