0

I using plotly express to plot a scatter with error lines for the y-axis. Here's a MWE:

import plotly.express as px

fig = px.scatter(
        y=np.array([13,21,19]),
        x=np.array([10,18,15]),
        error_y = np.array([1,2,3])
    )
fig.update_traces(textposition="bottom right", marker=dict(
        color='black')
)
fig.show()

I want to change the style of the error line. First, I want to delete the cap, as here. Second, I would like to make a dashed line instead of the solid line.

I looked through the Plotly documentation, but I don't see a straightforward way to do this. By adjusting the marker you cannot change the line apparently.

Thanks for any help or idea.

Ignacio
  • 53
  • 6
  • To my recollection, there is no example of changing to a dashed line. This [second answer](https://stackoverflow.com/questions/76545549/unilateral-error-bars-in-plotly-stacked-bar-chart) may be helpful for techniques to process the whiskers. – r-beginners Jul 01 '23 at 13:32
  • `width=0` should resolve the cap issue. – Ali Massoud Jul 01 '23 at 14:33
  • @AliMassoud that solved the cap issue, yes. Many thanks. For the record, I added this line: fig.update_traces(error_y=dict(width=0)) – Ignacio Jul 01 '23 at 17:16

0 Answers0