Skip to content

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

Open
@ilongshan

Description

@ilongshan

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions