-
-
Save jurand71/1010a445acb8503b347ce86fc02cf79d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dokladamy narzedzie HoverTool | |
from bokeh.io import output_file, output_notebook | |
from bokeh.plotting import figure, show | |
from bokeh.models.tools import HoverTool | |
from bokeh.models import ColumnDataSource | |
output_file('images/bokeh_hoover_gzfw2022.html', title='Generacja źródeł fotowoltaicznych i wiatrowych') | |
source_pv = ColumnDataSource({'date':df.index, | |
'value':df['Generacja źródeł fotowoltaicznych'] | |
}) | |
source_wind = ColumnDataSource({'date':df.index, | |
'value':df['Generacja źródeł wiatrowych'] | |
}) | |
fig_name = 'Ilość energii wytwarzanej ze źródeł fotowoltaicznych i wiatrowych w 2022 roku' | |
img = figure(title=fig_name, | |
x_axis_type='datetime', | |
tools='xpan,wheel_zoom,box_zoom,save,reset', | |
toolbar_location='below' | |
) | |
line_pv = img.line(x='date', y ='value', source = source_pv, | |
color='green', line_width=1, legend_label='Generacja ze źródeł fotowoltaicznych') | |
img.add_tools(HoverTool(renderers=[line_pv], tooltips=[('PV',"@{value}")], mode='vline')) | |
line_wind = img.line(x='date', y ='value', source = source_wind, | |
color='orange', line_width=1, legend_label='Generacja ze źródeł wiatrowych') | |
img.add_tools(HoverTool(renderers=[line_wind], tooltips=[('Wind',"@{value}")], mode='vline')) | |
img.yaxis.axis_label='MWh' | |
show(img) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment