plotly / plotly/plotly.R

Opacity/alpha as attribute linked to a continuous variable

Offen
#1,663 0 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

I am trying to get a continuous transparency according to a continuous variable that also defines the color. I've tried the code suggested in this post https://github.com/ropensci/plotly/issues/389 but I dont manage to do what I want and, in fact, I get very unexpected plots since the colorbar and marker's colors do not match + transparency seems the same for all colors.

require(plotly)
plot_ly(x = rnorm(100), y = rnorm(100), z = rnorm(100),
color = rbeta(100,shape1=1,shape2=1),alpha=.2,
type = "scatter3d", mode= "markers",
colors=colorRamp(c("blue","red")))

I'd like to get low transparency at high color values and vice versa. Is this possible in the currrent version of plot_ly?

plot_ly(x = rnorm(100), y = rnorm(100), z = rnorm(100),
color = rbeta(100,shape1=1,shape2=1),opacity=.2,
type = "scatter3d", mode= "markers",
colors=colorRamp(c("blue","red")))

setting opacity instead of alpha seems to fix the colouring vs colorbar but not the transparency issue.

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 mit den reproduzierbaren plot_ly-scatter3d-Beispielen im Issue und untersuche, wie Farbe, Alpha und Opazität für Marker abgebildet werden. Überprüfe das Verhalten anhand der colorbar und des Erscheinungsbilds der Marker; als erledigt gilt die Aufgabe, wenn eine kontinuierliche Variable sowohl Farbe als auch Transparenz wie angefordert steuern kann, ohne dass die Farben nicht übereinstimmen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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