Custom contours plotly python

Viewed 131

I am using plotly and I am lookin to create a custom contour:

fig = go.Figure(data =
    go.Contour(
        z=z,
        x=x, # horizontal axis
        y=y, # vertical axis
        contours=dict(
            start=0,
            end=5000,
            size=1000,
        ),
    ))

Contours here create a countours at: 1000, 2000, 3000, 4000, 5000.

Is there any way to create custom contours like: 0.1, 0.5, 1, 10, 100, 1000, 5000?

SECOND TRY:

I used contour constraints:

fig.add_trace(Contour(
        colorscale=colorscale,
        z=(df['Result']),
        x=df['Y'], # horizontal axis
        y=df['X'], # vertical axis
        name='até 8 µSv/hr',
        fillcolor='#2492ff',
        contours=dict(
            type='constraint',
            operation='<=',
            value=8,
        ),
    ))      

fig.add_trace(Contour(
        colorscale=colorscale,
        z=(df['Result']),
        x=df['Y'], # horizontal axis
        y=df['X'], # vertical axis
        name='até 10 µSv/hr',
        fillcolor='#24ffff',
        contours=dict(
            type='constraint',
            operation='<=',
            value=10,
        ),
    ))      

fig.add_trace(Contour(
        colorscale=colorscale,
        z=(df['Result']),
        x=df['Y'], # horizontal axis
        y=df['X'], # vertical axis
        name='até 20 µSv/hr',
        fillcolor='#33ff36',
        contours=dict(
            type='constraint',
            operation='<=',
            value=20,
        ),
    ))  

I obtained this:!Plotly contours using constraints]

The problem here is that there is no gradient of colors because I used separate traces..Any sugestions?

0 Answers
Related