plotly / plotly/plotly.py

enable setting px.scatter error bars of same color as the marker

Open
#3,803 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

I am making an error bar plot using px.scatter. I want to set each error bar to the same color as the marker. Below is the code showing how I am making the scatter plot. As can be seen from the code, I have a continuous scale and the markers are colored based on the column 'size' from my dataframe. I have looked quite a lot in the plotly documentation but I am unable to find a way to set the error bars of the same color as the marker. Is there a fix for this? Does plotly support different colored error bars for continuous data? Any help or suggestions would be appreciated.

I have also attached a link to the screenshot of the plot (the plot is zoomed in). As can be seen from the plot, the markers have colors based on the continuous scale whereas the all the lines have the same color.

df = pd.read_csv(options['file'], sep = ',')
size = df['size'].to_list()
fig = px.scatter(df, 
                x = "start", 
                y = "rank", 
                error_x = "duration",
                render_mode = 'auto', 
                facet_row = 'api',
                category_orders ={"api": ["MPIIO", "POSIX"]})

fig.update_traces(
    marker = dict(
        color= size,
        colorscale = "portland",
        colorbar=dict(
            title = "Request Size <br>(Bytes)",
            thickness=20
        ), 
        showscale=True
    ),                   
    error_x = dict(
        width = 0,
        symmetric=False,
    ),
)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported px.scatter example with continuous marker colors and error_x enabled, starting from the px.scatter and fig.update_traces calls shown in the issue. Determine whether Plotly supports mapping continuous marker colors onto error bars, and consider the work complete when the example produces error bars matching each marker color or the limitation is documented with a clear explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.