コード例 #1
0
ファイル: Bokeh.py プロジェクト: jgazal/DSA_Python-FAD
show(p)

# Plots de Séries Temporais com Pandas
import pandas as pd
from bokeh.plotting import figure, output_file, show

AAPL = pd.read_csv(
    "http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=0&e=1&f=2010",
    parse_dates=['Date'])

output_file("Bokeh-Datetime.html")

# create a new plot with a datetime axis type
p = figure(width=800, height=250, x_axis_type="datetime")

p.line(AAPL['Date'], AAPL['Close'], color='navy', alpha=0.5)

show(p)

# Google Maps
from bokeh.io import output_file, show
from bokeh.models import (GMapPlot, GMapOptions, ColumnDataSource, Circle,
                          DataRange1d, PanTool, WheelZoomTool, BoxSelectTool)

map_options = GMapOptions(lat=-23.5431786,
                          lng=-46.62918450000001,
                          map_type="roadmap",
                          zoom=11)

plot = GMapPlot(x_range=DataRange1d(),
                y_range=DataRange1d(),
コード例 #2
0
    df["Temperature"] = df["Temperature"]/10
    df["Pressure"] = df["Pressure"]/10

    p = figure(plot_width=500, plot_height=400, tools='pan,resize', logo=None)

    p.title = "Temperature and Air Pressure"
    p.title_text_color = "Gray"
    p.title_text_font = "arial"
    p.title_text_font_style = "bold"
    p.xaxis.minor_tick_line_color = None
    p.yaxis.minor_tick_line_color = None
    p.xaxis.axis_label = "Temperature (°C)"
    p.yaxis.axis_label = "Pressure (hPa)"                  

    p.circle(df["Temperature"],df["Pressure"], size=0.5)
    output_file("Weather.html", mode='cdn')
    # The JS and CSS will be fetched from CDN by default
    # output_file("Weather.html", mode='inline')
    # output_file("Weather.html", mode='relative')
    # show(p)


    # ----- (4) Time Date Plot -----

    df = pandas.read_csv('http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=0&e=1&f=2010', 
        parse_dates=["Date"])
    p = figure(width=500, height=250, x_axis_type='datetime', responsive=True)
    p.line(df['Date'], df['Close'], color='Orange', alpha=0.5)
    output_file('Timeseries.html')
    show(p)