olive
olive

Reputation: 189

Hide outliers in plotly boxplot with px.box in python

I have the following boxplot in plotly for my streamlit application: `

fig = px.box(df, x=x_column, y=y_column, color=x_column)    
st.plotly_chart(fig,use_container_width=True)

I have not found a working solution to hide the outliers in my boxplot.

The boxplot:

enter image description here

The desired boxplot:

enter image description here

Anyone who knows how I can achieve this? Thank you!

Upvotes: 3

Views: 2168

Answers (1)

Hamzah Al-Qadasi
Hamzah Al-Qadasi

Reputation: 9786

You can simply use points=False to remove outliers:

import plotly.express as px
df = px.data.tips()
fig = px.box(df, y="total_bill", points=False)
fig.show()

With outliers:

enter image description here

After removing outliers: enter image description here

Upvotes: 4

Related Questions