Commit cca3ebf5 authored by Decoupes Remy's avatar Decoupes Remy
Browse files

work on a plotly express subplot

parent c76f0abf
......@@ -15,7 +15,7 @@ import requests
import pandas as pd
import plotly.express as px
import plotly.io as pio
from plotly.subplots import make_subplots
def logsetup():
"""
......@@ -235,7 +235,21 @@ if __name__ == '__main__':
df_kw_by_disease = pd.concat([df_kw_by_disease, df], axis=1)
# df_kw_by_disease_without_covid = df_kw_by_disease[df_kw_by_disease["disease"] != "SARS-CoV-2 "]
logger.debug(df_kw_by_disease.keys())
timeseries_fig = px.bar(df_kw_by_disease["Influenza"], facet_col_wrap=2)
timeseries_fig.show()
# make subplot
list_disease_with_timeserie = set([d[0] for d in df_kw_by_disease.keys()])
nb_of_subplots = len(list_disease_with_timeserie)
subplots_timeseries_fig = make_subplots(rows=nb_of_subplots, cols=1)
current_row = 0
for disease in list_disease_with_timeserie:
timeserie_fig = px.bar(df_kw_by_disease[disease], facet_col_wrap=2)
current_row = current_row + 1
# timeserie_fig.show()
"""
Make a subplot with plotly express: it has net been implemented yet !
Instead we have to convert our plotly express object into trace
"""
for trace in range(len(timeserie_fig["data"])):
subplots_timeseries_fig.add_trace(timeserie_fig["data"][trace], row=current_row, col=1)
subplots_timeseries_fig.show()
logger.info("EDA stop")
......@@ -32,7 +32,7 @@
"time_serie": {
"date_histogram": {
"field": "@timestamp",
"fixed_interval": "30d",
"fixed_interval": "7d",
"time_zone": "Europe/Paris"
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment