plotly / plotly/plotly.py

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

Offen
#5,006 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P3
Vorherrschende Sprache
Python
Sterne
18.8k
Forks
2.8k
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
21

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Führe zunächst das bereitgestellte minimale Python-Beispiel mit plotly.graph_objects.Surface und aktiviertem contours_z aus und vergleiche die Konturfarben mit der colorscale der Oberfläche. Verfolge den Pfad der Konturfarbgebung von Surface und überprüfe, dass die Konturlinien die vollständige ausgewählte colorscale verwenden; abgeschlossen ist die Aufgabe, wenn die Konturlinien mit den entsprechenden Oberflächenfarben übereinstimmen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.