adicion de grafica de distribucion de %s de macros

parent 246439e5
......@@ -191,7 +191,27 @@ def comidas_describe(datos):
)
return figura
def comidas_porcentajes(datos):
columnas = ["hc_total", "fiber_total", "protein_total", "lipids_total"]
datos["total"] = datos[columnas].sum(axis=1)
datos = datos[datos["total"]>0]
datos[columnas] = datos[columnas].div(datos["total"], axis=0)
print(datos[columnas].head())
figura = go.Figure()
lrow = 1
lcol = 1
for columna in columnas:
datosfil = datos[np.abs(stats.zscore(datos[columna], nan_policy='omit')) < 3]
figura.add_trace(
go.Histogram(x=datosfil[columna], name=columna),
)
figura.update_layout(
bargap=0.05, # gap between bars of adjacent location coordinates
bargroupgap=0.05 # gap between bars of the same location coordinates
)
return figura
def heatmap(datos):
datosfil = datos.replace(0,np.nan)
......@@ -414,6 +434,12 @@ app.layout = html.Div(children=[
html.Div(children= [html.H1("Distribución de Macronutrientes de comidas", className = "header-title2")]),
dcc.Graph(figure=comidas_describe(comidas))
,]),
# descripcion de componentes de macronutrientes de comidas
html.Div(children= [
html.Div(children= [html.H1("Distribución de %s de Macronutrientes de comidas", className = "header-title2")]),
dcc.Graph(figure=comidas_porcentajes(comidas))
,]),
# descripcion de comidas por paciente
html.Div(children= [
html.Div(children= [html.H1("Macronutrientes de comidas por paciente", className = "header-title2")]),
......
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