tx3bas commited on
Commit
ef68ace
·
verified ·
1 Parent(s): 7f5480a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -61,8 +61,9 @@ with st.sidebar.expander("Opciones Adicionales"):
61
  opacity = st.slider("Opacidad (%)", min_value=0, max_value=100, value=30, step=1) / 100
62
  border_width = st.slider("Grosor del Borde", min_value=0.0, max_value=3.0, value=1.5, step=0.1)
63
  border_opacity = st.slider("Opacidad del Borde (%)", min_value=0, max_value=100, value=60, step=1) / 100
64
- if chart_type == "Barras" and num_y_vars > 1:
65
- bar_mode = st.radio("Modo de Barras", ["Normal", "Superpuestas"])
 
66
  if chart_type == "Donut":
67
  hole_size = st.slider("Tamaño del agujero (%)", min_value=0, max_value=100, value=30, step=1) / 100
68
 
@@ -142,16 +143,18 @@ else:
142
  fig.update_traces(marker_color=color, marker_line_color=border_color, marker_line_width=border_width)
143
  elif chart_type == "Barras":
144
  if num_y_vars > 1:
145
- if bar_mode == "Normal":
146
- fig = px.bar(data, x="X", y=y_names_list, barmode='group')
147
- else:
148
  fig = px.bar(data, x="X", y=y_names_list, barmode='overlay')
 
 
149
  else:
150
  fig = px.bar(data, x="X", y=y_names_list)
151
- if use_multiple_colors:
152
- fig.update_traces(marker_color=colors[:len(x)], marker_line_color=border_colors[:len(x)], marker_line_width=border_width)
153
- else:
154
- fig.update_traces(marker_color=color, marker_line_color=border_color, marker_line_width=border_width)
 
 
155
  fig.update_traces(hovertemplate=hovertemplate)
156
  fig.update_layout(bargap=0.2)
157
  elif chart_type == "Donut":
 
61
  opacity = st.slider("Opacidad (%)", min_value=0, max_value=100, value=30, step=1) / 100
62
  border_width = st.slider("Grosor del Borde", min_value=0.0, max_value=3.0, value=1.5, step=0.1)
63
  border_opacity = st.slider("Opacidad del Borde (%)", min_value=0, max_value=100, value=60, step=1) / 100
64
+ if chart_type == "Barras":
65
+ stacked_bars = st.checkbox("Superpuestas")
66
+ horizontal_bars = st.checkbox("Invertidas")
67
  if chart_type == "Donut":
68
  hole_size = st.slider("Tamaño del agujero (%)", min_value=0, max_value=100, value=30, step=1) / 100
69
 
 
143
  fig.update_traces(marker_color=color, marker_line_color=border_color, marker_line_width=border_width)
144
  elif chart_type == "Barras":
145
  if num_y_vars > 1:
146
+ if stacked_bars:
 
 
147
  fig = px.bar(data, x="X", y=y_names_list, barmode='overlay')
148
+ else:
149
+ fig = px.bar(data, x="X", y=y_names_list, barmode='group')
150
  else:
151
  fig = px.bar(data, x="X", y=y_names_list)
152
+ if horizontal_bars:
153
+ fig.update_traces(orientation='h')
154
+ if use_multiple_colors:
155
+ fig.update_traces(marker_color=colors[:len(x)], marker_line_color=border_colors[:len(x)], marker_line_width=border_width)
156
+ else:
157
+ fig.update_traces(marker_color=color, marker_line_color=border_color, marker_line_width=border_width)
158
  fig.update_traces(hovertemplate=hovertemplate)
159
  fig.update_layout(bargap=0.2)
160
  elif chart_type == "Donut":