Comunicando com texto

Visualização Interativa de Dados com Bokeh

George Boorman

Core Curriculum Manager, DataCamp

Nosso gráfico

gráfico_sem_título

Visualização Interativa de Dados com Bokeh

Adicionando um título

fig = figure(x_axis_label='Assists per Game', y_axis_label='Points per Game',

title="Points vs. Assists by Conference")
fig.circle(x='assists', y='points', source=east, color='blue', legend_label='East') fig.circle(x='assists', y='points', source=west, color='red', legend_label='West') output_file(filename="points_vs_assists_by_conference.html") show(fig)

gráfico_com_título

Visualização Interativa de Dados com Bokeh

Personalizando o título

fig.title.text_font_size = "30px"

fig.title.align = "center"
output_file(filename="modified_title.html") show(fig)

título_personalizado

Visualização Interativa de Dados com Bokeh

Modificando a legenda

fig.legend.title = "Conference"

fig.legend.location = "bottom_right"
show(fig)
legend.location
"top_left"
"top_right"
"bottom_left"
"bottom_right"

título_da_legenda_em_itálico

Visualização Interativa de Dados com Bokeh

Estilo da fonte do título da legenda

legend.title_text_font_style
"bold"
"normal"
"italic"
Visualização Interativa de Dados com Bokeh

Estilo da fonte do título da legenda

fig.legend.title_text_font_style = "normal"

output_file(filename="normal_legend_title.html") show(fig)

título_de_legenda_normal

Visualização Interativa de Dados com Bokeh

Exibindo uma legenda interativa

fig.legend.click_policy = "hide"

output_file(filename="interactive_legend.html") show(fig)

legenda_interativa

Visualização Interativa de Dados com Bokeh

O conjunto de dados

print(bakery.shape)
(17486, 6)
print(bakery.columns)
Index(['transaction', 'items', 'day_time', 'day_type', 'date', 'sales'],
dtype='object')
Visualização Interativa de Dados com Bokeh

Vamos praticar!

Visualização Interativa de Dados com Bokeh

Preparing Video For Download...