plotly / plotly/plotly.R

Opacity in Grouped Bar Charts with data.frame

Offen
#1,666 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

When plotting a grouped bar chart with variable opacity with data in a data.frame, the opacity assigned to each column is not the one specified in the data.frame. In the example below, the 2 bars in group "A" are plotted with reduced opacity, as opposed to the 2 bars with colour "C". Strangely, if the data.frame is not ordered then it plots correctly.

library( plotly )

data  = data.frame( 
  x      = c( "A", "B", "A", "B" ),
  y      = c(   1,   2,   3,   4 ),
  z      = c( "C", "C", "D", "D" ),
 opacity = c( 0.3, 0.3,   1,   1 )
)

# removing this lines the plot is correct
data = data[ order( data$x ),]

p = plot_ly( 
  data   = data, 
  x      = ~x, 
  y      = ~y, 
  color  = ~z, 
  marker = list( opacity = ~opacity ),
  type   = "bar" ) %>% 
layout( barmode = "group" )
show( p )


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, die bereitgestellte R-Reproduktion in plotly.R mit sowohl geordnetem als auch ungeordnetem Data Frame auszuführen. Verfolge die Verarbeitung der Marker-Opazität im gruppierten Balkendiagramm und vergleiche die Opazität jedes Balkens mit den Werten im Data Frame. Die Aufgabe ist erledigt, wenn die Anordnung der Daten nicht mehr verändert, welche Balken eine reduzierte Opazität erhalten.

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
45/100

Neue Issues direkt in Ihr Postfach

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