plotly / plotly/plotly.py

`plotly.graph_objects.Scatter` property `fillgradient` does not plot gradients with v5.22.0 in python

Open
#4,649 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

I am trying to use the fillgradient in a scatter plot with plotly.
I copied the documentation code for its use, but on code execution, the gradient does not appear.

Operating system & Environment
  • OS: macOS Sonoma 14.5
  • language: python 3.11.3
  • relevant libraries (working on VSCode in a jupyter notebook)
    • plotly 5.22.0
    • jupyterlab 3.6.3
    • ipywidgets 8.0.4
    • notebook 6.5.4
Code used
import plotly.graph_objects as go

fig = go.Figure(
    [
        go.Scatter(
            x=[1, 2, 3, 4],
            y=[3, 4, 8, 3],
            fill=None,
            mode="lines",
            line_color="darkblue",
        ),
        go.Scatter(
            x=[1, 2, 3, 4],
            y=[1, 6, 2, 6],
            fill="tonexty",
            mode="lines",
            line_color="darkblue",
            fillgradient=dict(
                type="horizontal",
                colorscale=[(0.0, "darkblue"), (0.5, "royalblue"), (1.0, "cyan")],
            ),
        ),
    ]
)

fig.show()

Output in picture:
image

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 issue from the provided Python example in a Jupyter notebook using the listed Plotly 5.22.0 environment, starting at fig.show() and the Scatter fillgradient configuration. Compare the rendered output with the documented gradient-fill example; the issue is done when the configured gradient appears in the scatter fill.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.