I guys I need your help I tried many approaches but I cannot figure out what the issue is.
I am running this in a Jupyter Notebook.
import plotly.graph_objects as go
import plotly.offline
plotly.offline.init_notebook_mode()
import matplotlib.pyplot as plt
fechas_corte = EstadosDeCuentaData['fecha_corte'].unique()
num_colors = len(fechas_corte)
cmap = plt.get_cmap('tab10') # You can choose other colormaps like 'viridis', 'plasma', etc.
colors = [cmap(i) for i in range(num_colors)]
fig = go.Figure()
for i, fecha_corte in enumerate(fechas_corte):
fecha_corte_data = EstadosDeCuentaData[EstadosDeCuentaData['fecha_corte'] == fecha_corte]['saldo']
line_color = f'rgba({colors[i][0]}, {colors[i][1]}, {colors[i][2]}, {colors[i][3]})'
list_i_values_to_display=[0,1,2,3]
if i in list_i_values_to_display:
fig.add_trace(go.Violin(x=fecha_corte_data, line_color=line_color,name=str(fecha_corte)))
fig.update_traces(orientation='h', side='positive', width=3, points=False)
fig.update_layout(xaxis_showgrid=True, xaxis_zeroline=False)
fig.show()
In this code if list_i_values_to_display=[0]
Shows:
And this happens with any number , that proves I have data in all the cases of i
but if list_i_values_to_display=[0,1,2] for examples shows this:
What I am missing here?