Black Lives Matter. Please consider donating to Black Girls Code today.

Box plot doesn't show anything when I try to separate data using color or facet column

I am a student and I was working on some of my data. They are stored in a csv file with column names ‘x’, ‘t’, ‘y1’, ‘y2’.

When I plot t-y1 using scatter plot it works. For the box plot if I plot the entire dataset, it works too. But when I want to separate the t-y1 plots in colors (on in facet column) based on the entry in column ‘x’, the plot shows nothing at all. Below I put the code and the plot I got from plotly. Here I put my dataset.

import pandas as pd

from plotly.offline import plot
import plotly.graph_objs as go
import plotly.express as px
from plotly.subplots import make_subplots

df=pd.read_csv(‘My_data.csv’)

fig=px.scatter(df,x=‘t’,y=‘y1’)
fig.update_layout(title=‘My Data’,xaxis_type=‘log’,yaxis_type=‘linear’)
plot(fig)

fig=px.box(df,x=‘t’,y=‘y1’)
fig.update_layout(title=‘My Data’,xaxis_type=‘log’,yaxis_type=‘linear’)
plot(fig)

fig=px.box(df,x=‘t’,y=‘y1’,color=‘x’)
fig.update_layout(title=‘My Data’,xaxis_type=‘log’,yaxis_type=‘linear’)
plot(fig)

Hi @alamjhilam welcome to the forum! Did you try converting the type of the x column to string ? Maybe the categories need to be the discrete values of this column, but they are note computed if the column has a numerical type.

Thanks Emmanuelle. I tried it, but the problem remains.

However I narrowed down the issue further. Plotly fails only if I want log scale along xaxis. For linear, it works no matter whether I work with string or numeric values. Here you can see a linear-linear and log-linear plot.