1

I'm trying to use plotly violin plot for a logarithmic data set with positive values only.

when I use the regular violin aka:

fig= go.Figure()
fig.add_trace(go.Violin(x=last_value, line_color=color, name=round(leverage, 3),spanmode='hard'))
fig.update_traces(orientation='h', side='positive', width=3, points=False)
fig.show()

I get :

enter image description here

adding the line

fig.update_xaxes(type='log')

I get

enter image description here

As the data is supposed to reflect probabilities a log transformation yields the following.

fig.add_trace(go.Violin(x=np.log10(last_value), line_color=color, name=round(leverage, 3),spanmode='hard'))

enter image description here

The problem is that I want the x-axis and hover data to reflect the actual data, not the log10 of the data. Is there any way to achieve this?

A short summed up example code :

last_value=np.load('data.npy')

fig=go.Figure()
fig.add_trace(go.Violin(x=last_value, spanmode='hard'))
fig.update_traces(orientation='h', side='positive', points=False)
fig.update_xaxes(type='log')
fig.show()

fig=go.Figure()
fig.add_trace(go.Violin(x=np.log10(last_value), spanmode='hard'))
fig.update_traces(orientation='h', side='positive', points=False)
fig.show()

the data file is uploaded here:

https://fastupload.io/ba8b4df5120a5ce8

2
  • Hi Tomer, do you mind adding some data? A minimal reproducible example will be great Commented May 3, 2024 at 14:40
  • Hey i inserted an edit and uploaded the data set :) sorry for the delay Commented May 10, 2024 at 10:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.