Want to display q1, q3 by interpolation='linear' only in case of violin & box plotting

40 views Asked by At

I want to display q1, q3 using concept of interpolation='linear' only in case of violin & box plots while using plotly.graph_objects.Box or Violin. I observed by default q1 and q3 are set using the concept of interpolation='midpoint'. Please find the code below.

import pandas as pd
import plotly.express as px
import plotly.graph_objects as go

tips = px.data.tips()

fig = go.Figure(data=go.Violin(y=tips["total_bill"], 
                               box_visible=True, 
                               line_color='black',
                               meanline_visible=True, 
                               fillcolor='lightseagreen', 
                               opacity=0.3,
                               x0="total_bill",
                              )
               )
fig.update_layout(yaxis_zeroline=False)
fig.show()

The above code shows q1=13.325, q3=24.175 using 'midpoint' interpolation by default, but I force to use 'linear' interpolation to show q1=13.347500 & q3=24.127500.

Could you please help me to modify the code accordingly that diagram considers 'linear' interpolation.

0

There are 0 answers