コード例 #1
0
show(row(box1, box2))

# In[6]:

# 弦图 Chord
chord1 = Chord(data=exercise, source="id", target="kind")
chord2 = Chord(data=exercise, source="id", target="kind", value="pulse")

show(row(chord1, chord2))

# * bokeh.plotting

# In[7]:

from bokeh.plotting import figure
import numpy as np

p = figure(plot_width=400, plot_height=400)
# 方框
p.square(np.random.randint(1, 10, 5),
         np.random.randint(1, 10, 5),
         size=20,
         color="navy")

# 圆形
p.circle(np.random.randint(1, 10, 5),
         np.random.randint(1, 10, 5),
         size=10,
         color="green")
show(p)
コード例 #2
0
#!/usr/local/opt/python3/bin/python3

import pandas
from bokeh.charts import Scatter
from bokeh.plotting import figure, output_file, show

df = pandas.DataFrame(columns=["X-Axis", "Y-Axis"])
df["X-Axis"] = [1, 2, 3, 4, 5]
df["Y-Axis"] = [5, 6, 4, 5, 3]
p = Scatter(df,
            x="X-Axis",
            y="Y-Axis",
            title="Temperature Observations",
            xlabel="Day of Observations",
            ylabel="Temperature")

output_file("Scatter_charts.html")
show(p)

p = figure(plot_width=500, plot_height=500, title="Earthquakes")
# p.circle([1,2,3,4,5],[3,4,6,1,7],size=12,color="red",alpha=0.5)
# p.triangle([1,2,3,4,5],[3,4,6,1,7],size=12,color="red",alpha=0.5)
# p.circle([1,2,3,4,5],[3,4,6,1,7],size=[8,12,14,16,18],color="red",alpha=0.5)
p.circle([1, 2, 3, 4, 5], [3, 4, 6, 1, 7],
         size=[i * 2 for i in [8, 12, 14, 16, 18]],
         color="red",
         alpha=0.5)
show(p)
output_file("Scatter_plotting.html")
コード例 #3
0
ファイル: Bokeh.py プロジェクト: jgazal/DSA_Python-FAD
                    inner="stick")

output_file("Bokeh-ViolinPlot.html")

show(mpl.to_bokeh())

# Gráficos de Linha
from bokeh.plotting import figure, output_file, show

# Outuput
output_file("Bokeh-Grafico-Linha.html")

p = figure(plot_width=400, plot_height=400)

# Adicionando círculos ao gráfico
p.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)

# Mostrando o resultado
show(p)

# Geojson
from bokeh.io import output_file, show
from bokeh.models import GeoJSONDataSource
from bokeh.plotting import figure
from bokeh.sampledata.sample_geojson import geojson

geo_source = GeoJSONDataSource(geojson=geojson)

p = figure()
p.circle(x='x', y='y', alpha=0.9, source=geo_source)
output_file("Bokeh-GeoJSON.html")
コード例 #4
0
    # ----- (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)
    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"