I have a dataset stored in a pandas dataframe. I plot them using plotly.express. My code is given below.
As you can see the facet columns are not organized as per ascending/descending value of the “Vov” field. The same is true for facet row. I look for the unique values of “Vov” and “T” field from the dataframe. It turns out that plotly is just following the sequence that comes from the data[‘Vov’].unique() command.
I also checked, the datatype of both the “Vov” field and “T” field is float64, not str.
How can I organize the facet rows and columns in a right sequence?
fig = px.scatter(data, x=“x”, y=“y”, color=round(np.log10(data[“z”])), facet_col=data[“Vov”],facet_row=‘T’)
fig.update_layout(coloraxis_colorbar=dict(title=“Z”,))
fig.update_yaxes(type=“log”)
fig.update_xaxes(type=“log”)
fig.show()