ggplotly: problems with facet_grid/axes
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'm trying to display some block-matrix-like plot, and there are a few regressions when converting from ggplot to ggplotly conversion (ranked by severity):
- degenerated (1 value) discrete axes are implicitly converted into continuous numeric axis centered around
1, original labels not displayed switch="both"andstrip.placement = "outside"options ignored (here it's important because with ggplot I am able to have sort-of 2-level hierarchy for X and Y axes, which ggplotly breaks)- some subplots with missing data are displayed (at 3x3 position), some don't (2x2 position)
- the margins for the X labels are too small (is the text rotation considered when calculating the necessary space?)
space="free"option ignored- within my shiny application the diagonal subplots miss the fill color. It's an important issue, but I cannot make a small reproducible example (screenshot attached).
ggplot2

ggplotly

ggplotly from Shiny app

The code
require(readr)
require(plotly)
require(ggplot2)
peakXpepmod.df <- read_tsv("CAPZA1_example.txt",
col_types = list("pepmod_id"="c", "peak_id"="c", "proteoform_id"="c", "pmgroup_id"="c")) %>%
dplyr::mutate(pepmod_id = factor(pepmod_id),
peak_id = factor(peak_id),
proteoform_id = factor(proteoform_id),
pmgroup_id = factor(pmgroup_id))
p <- ggplot(peakXpepmod.df) +
geom_point(aes(x = pepmod_id, y = peak_id,
color = proteoform_id), shape=15, size=8) +
geom_point(aes(x = pepmod_id, y = peak_id,
shape = pmgroup_id), size=5) +
scale_x_discrete("Pepmods") + scale_y_discrete("Peaks") +
theme( axis.line = element_line(colour = "gray80"),
axis.ticks = element_line(colour = "gray80"),
axis.text.x = element_text(angle = 90, hjust = 1),
strip.background = element_rect(colour="gray"),
strip.placement = "outside") +
facet_grid(proteoform_id ~ pmgroup_id, switch="both", scales = "free", space = "free")
# ggplot
p
# ggplotly
ggplotly(p)
The dataset
CAPZA1_example.txt
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduzieren Sie den Bericht, indem Sie das bereitgestellte R-Beispiel mit CAPZA1_example.txt ausführen, p mit ggplotly(p) vergleichen und sich auf die Konvertierung von facet_grid konzentrieren. Es ist keine Projektdatei und kein Test benannt; als erledigt gilt die Aufgabe, wenn die aufgeführten Regressionen bei Achsen, Streifen, fehlenden Teilplots, Rändern, Abständen und Füllfarben behoben sind, wobei den reproduzierbaren Fällen besondere Aufmerksamkeit gilt.
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
- 32/100