plotly / plotly/plotly.py

enable fill between two lines in y direction only within intersection part

Open
#4,311 11 comments 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

This code snippet will plot two lines:

import plotly.graph_objs as go

anchor_rate = [1000, 1660.89, 3220.62, 5927.36]
anchor_psnr = [31.799098, 34.155477, 36.053423, 36.5]

tested_rate = [752.33,1608.90,3114.10,5685.72]
tested_psnr = [31.336015,33.752160,35.730303,37.200365]

fig = go.Figure()

fig.add_trace(go.Scatter(
    x=anchor_rate,
    y=anchor_psnr,
))

fig.add_trace(go.Scatter(
    x=tested_rate,
    y=tested_psnr,
))

fig.show()

This is the plot:
newplot (1)

How to fill between two lines in y direction only within intersection part, like this? And how can fill them with different colors?
newplot

In summary, two questions:

  1. How to fill between two lines in y direction only within intersection part?
  2. And how can fill them with different colors?

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

Start by reproducing the provided Python example with two go.Scatter traces and compare it with the requested intersection-only plot. Investigate the existing Scatter fill behavior and determine how the two questions—restricted filling and different colors—should be supported; done means both requested outcomes are demonstrated or specified clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.