from bokeh.layouts import gridplot
from bokeh.plotting import figure,show,output_file
t=numpy.linspace(0,2*numpy.pi,1280);
x=(numpy.cos(12*t)+numpy.cos(6*t))*numpy.cos(t)
y=(numpy.cos(12*t)+numpy.cos(6*t))*numpy.sin(t)
TOOLS='pan,wheel_zoom,box_zoom,reset,save,box_select'
p1=figure(title='PLotting Examples',tools=TOOLS)
p1.circle(x,y,legend_label=u'ϱ = cos 12θ + cos 6θ')
p1.circle(2*x,2*y,legend_label=u'2ϱ',color='red')
p1.legend.title='Polar Functions'
p1.legend.location='center'
p1.add_layout(p1.legend[0],'below')
p2=figure(title='Another Plotting Examples',tools=TOOLS)
p2.square(x,y,legend_label=u'ϱ = cos 12θ + cos 6θ')
p2.line(x,y,legend_label=u'ϱ = cos 12θ + cos 6θ')
p2.square(2*x,2*y,legend_label=u'2ϱ',
fill_color=None,line_color='red')
p2.line(2*x,2*y,legend_label=u'2ϱ',line_color='red')
p2.legend.title='Polar Functions'
p2.legend.location='center'
p2.add_layout(p2.legend[0],'below')
output_file('bokeh_legend.html',title='plotting examples')
show(gridplot([p1,p2],ncols=int(2),
width=int(260),height=int(450)))
fpath='https://sagecell.sagemath.org/kernel/'
fpath+=os.getcwd()[14:]+'/files/bokeh_legend.html'
s1='<div id="data"><iframe src="'
s2='" height="500" width="600"></iframe></div>'
No comments:
Post a Comment