plotly / plotly/plotly.R

ColorScale Will Not Change If Specifying with colorscale = c('hexcode1', 'hexcode2')

Offen
#1,846 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
R
Sterne
2.7k
Forks
641
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi,

After following the guide here, https://plotly.com/r/3d-scatter-plots/, I found that, when specifying color scale with colorscale = c('hexcode1', 'hexcode2') will not have changes to the color scale, yet the default palette names such as 'Rainbow' will work. In this case, it would not be possible to self-define the 2 end points of the color scale. Please feel free to run the R codes below to see what I mean.


library(dplyr)
library(plotly)

fig <- plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec,
               marker = list(color = ~mpg, 
                             #colorscale = c('#FF0000', '#00FF72'), 
                             #colorscale ='Rainbow',
                             colorscale = c('#132B43', '#56B1F7'),
                             showscale = TRUE))
fig <- fig %>% add_markers()
fig <- fig %>% layout(scene = list(xaxis = list(title = 'Weight'),
                                   yaxis = list(title = 'Gross horsepower'),
                                   zaxis = list(title = '1/4 mile time')),
                      annotations = list(
                        x = 1.13,
                        y = 1.05,
                        text = 'Miles/(US) gallon',
                        xref = 'paper',
                        yref = 'paper',
                        showarrow = FALSE
                      ))
fig

Just wondering if this is a bug or may be there needs some updates to the guide?

Thanks,

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

Beginne damit, das bereitgestellte R-Beispiel aus dem Leitfaden zum 3D-Streudiagramm auszuführen, und vergleiche die benutzerdefinierte hexadezimale colorscale mit der funktionierenden Rainbow-Palette. Verfolge, wie colorscale durch plot_ly() und add_markers() weitergegeben wird. Erledigt ist die Aufgabe, wenn die beiden angegebenen Endpunktfarben die colorscale der Marker sichtbar steuern oder der Leitfaden die unterstützte Syntax dokumentiert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 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.