Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add plotly option #63

Open
shimwell opened this issue Nov 27, 2023 · 2 comments
Open

add plotly option #63

shimwell opened this issue Nov 27, 2023 · 2 comments

Comments

@shimwell
Copy link
Member

we can do a plotly contour with this code, perhaps easy to add

import plotly.graph_objects as go

fig = go.Figure(data =
    go.Contour(
        z=[[10, 10.625, 12.5, 15.625, 20],
           [5.625, 6.25, 8.125, 11.25, 15.625],
           [2.5, 3.125, 5., 8.125, 12.5],
           [0.625, 1.25, 3.125, 6.25, 10.625],
           [0, 0.625, 2.5, 5.625, 10]],
        x=[-9, -6, -5 , -3, -1], # horizontal axis
        y=[0, 1, 4, 5, 7] # vertical axis
    ))
fig.show()
@shimwell
Copy link
Member Author

shimwell commented Nov 28, 2023

slightly improved

    import plotly.graph_objects as go

    dx = abs(x_min - x_max)/(data.shape[0]-1)
    dy = abs(y_min - y_max)/(data.shape[1]-1)

    fig = go.Figure(data =
        go.Contour(
            z=data,
            x0=x_min,
            dx=dx,
            y0=y_min,
            dy=dy,
            showscale=colorbar
            label
        ))
    fig.show()

@shimwell
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant