Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Color of Contour lines in Surfaces with colormap are not correctly set #5006

Copy link
Copy link
Open
@jparisu

Description

@jparisu
Issue body actions

I think there is an issue in the way the lines plot by a contours in a Surface object when selecting the color.
I think the color is not being correctly selected by each of the lines. They are supposed to follow the colorscale, but they just follows half of it.

Here there is a minimum example of code to simulate the error:

import numpy as np
import plotly.graph_objects as go

x = np.linspace(0, 1, 100)
y = np.linspace(0, 1, 100)
x_grid, y_grid = np.meshgrid(x, y)

z = x_grid + y_grid

params = {
    'colorscale': 'rainbow',
    'surfacecolor': z,
    'showscale': True,
    'colorbar': {
        'title': 'z',
    },
    'contours_z': {
        'show': True,
        'usecolormap': True,
        "project_z": True,
    }
}

trace = go.Surface(
    x=x,
    y=y,
    z=z,
    **params)

fig = go.Figure(data=[trace])
fig.write_image("test.png")
fig.show()

In the example, the expected behavior will be for the contour lines to be the same color as the surface, but they are not.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbacklogbugsomething brokensomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.