plotly / plotly/plotly.R

Italicizing strip.text with ggplotly

Offen
#1,812 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've been trying to get the labels on a faceted grid to be italicized on the y-axis and can't seem to make it to happen.

Here I'll use the "Free Y Axis" example of a faceted grid as written by Plotly:
https://plotly.com/ggplot2/facet_grid/

The only change I've made to this code is make the strip text for both axes larger and the y-axis text italicized in the ggplot theme().

library(reshape2)
library(ggplot2)
library(plotly)

p <- ggplot(tips, aes(x=total_bill)) + geom_histogram(binwidth=2,colour="white")

# With panels that have the same scaling, but different range (and therefore different physical sizes)
p <- p + facet_grid(sex ~ smoker, scales="free", space="free") +
               theme(strip.text.x = element_text(size = 13),
               strip.text.y = element_text(size = 13,face = "italic"))

p

fig <- ggplotly(p)

fig

The plot produced by ggplot (p) looks like this, with the y-axis facet labels in italics:
image

The plot produced by ggplotly (fig) looks like this:
itali example plotly

Any clarification if I'm missing something would be appreciated. Thank you!

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 dem bereitgestellten Beispiel „Free Y Axis“ und vergleiche das ggplot-Objekt p mit dem ggplotly-Ergebnis fig. Konzentriere dich dabei darauf, wie die Gestaltung des Facet-Strip-Texts konvertiert wird. Stelle die fehlende kursive Gestaltung der Facet-Beschriftungen der y-Achse wieder her. Als abgeschlossen gilt die Aufgabe, wenn ggplotly den kursiven Schriftschnitt beibehält und gleichzeitig den größeren Strip-Text bewahrt.

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
Klar beschrieben
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

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