コード例 #1
0
    df['X'] = [1, 2, 3, 4, 5]
    df['Y'] = [6, 7, 8, 9, 10]
    p = Scatter(df, x='X', y='Y', title="Temperature Observation", 
        xlabel='Days of observations', ylabel='Temperature')

    output_file('Scatter_charts.html')  # Generate an HTML file
    # show(p)  # Show

    # ----- (2) Test using bokeh.plotting (recommended for more customization) -----
    
    # p = figure(plot_width=500, plot_height=400, title='Earthquake')
    p = figure(plot_width=500, plot_height=400)
    # help(p)
    p.title = 'Earthquake'
    p.title_text_color = 'Orange'
    p.title_text_font = 'Times'
    p.title_text_font_style = 'italic'
    p.yaxis.minor_tick_line_color = None
    p.xaxis.axis_label = 'Times'
    p.yaxis.axis_label = 'Value'

    # quad may also be used
    p.circle([4, 8, 12], [7, 14, 21], size=17, color='orange', alpha=0.5)
    # p.triangle(df['X'], df['Y'], size=10, color='red', alpha=0.5)
    p.triangle(df['X'], df['Y'], size=[5, 10, 15, 20, 25], color='red', alpha=0.5)
    output_file('Scatter_plotting.html')
    # show(p)

    # ----- (3) Exercise: Reading from excel -----

    df = pandas.read_excel("verlegenhuken.xlsx", sheetname=0)