0

So I'm trying to learn Bokeh, using Jupyter notebooks. When I use this code it works great: ''''

    X=tesla['Date']
Y=tesla['Close']
output_file('time.html') #output file, have to import
fig=figure(width=2000, height=2000,title='Tesla Stock', toolbar_location="below",x_axis_type="datetime") #create figure object
fig.title.text="Tesla Stock"
fig.title.text_color="Gray"
fig.title.text_font="times"
fig.title.text_font_style="bold"
fig.xaxis.minor_tick_line_color='Red'
fig.yaxis.minor_tick_line_color='Blue'
fig.xaxis.axis_label="Date"
fig.yaxis.axis_label="Close"  
fig.line(X,Y) #fig (see import above), line graph and variables
show(fig)

''''' The graphic I get looks like this: My messed chart

what am I doing wrong?

  • 1
    Bokeh connects the points of a line in the order you provide them. Clearly this data is not sorted by ascending date. You could either sort the x and y coordinates by date and keep using a line, or switch to a scatter plot instead, which does not have a connected topology. – bigreddot Aug 24 '22 at 19:08
  • Looks like you are working with stack data. Maybe the [candlestick example](http://docs.bokeh.org/en/latest/docs/gallery/candlestick.html) can help you. – mosc9575 Aug 25 '22 at 08:17

0 Answers0