Setting anchor = "free" in R subplot() causes the graph to disappear
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 build a subplot of stacked scatter plots, where there are multiple axes on each scatter plot.
Below is an example of the type of plot. To position the yaxis side-by-side, I have layout(yaxis(anchor = "free")) set am using position to place the axis.

All my attempts to set anchor = "free" in subplots left my plot space completely blank. Some testing revealed that even a subplot constructed from a single plot will not display if anchor="free"
Please see below REPREX.
require(plotly)
df <- data.frame(x = 1:10, y = 1:10, y2 = 10:19)
plt <- plot_ly(data = df) %>%
add_trace(x = ~x, y = ~y,
mode = "markers", type = "scatter",
yaxis = "y") %>%
add_trace(x = ~x, y = ~y2,
mode = "markers", type = "scatter",
yaxis = "y2") %>%
layout(
xaxis = list(
domain = c(.12, .88)
),
yaxis = list(
title = "y_1"
),
yaxis2 = list(
title = "y_2",
anchor = "free",
position = .10,
overlaying = "y"
),
margin = list(
pad = 60
)
)
subplot(plt)
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
Führen Sie zunächst das bereitgestellte R-reprex mit plot_ly(), layout() und subplot() aus, um zu bestätigen, dass anchor = "free" einen leeren Plot erzeugt. Verfolgen Sie anschließend, wie subplot() die Einstellungen für yaxis und yaxis2 verarbeitet, insbesondere anchor, position und overlaying. Als abgeschlossen gilt die Aufgabe, wenn der Subplot seine Traces rendert und dabei die frei positionierte Achse beibehält.
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
- 42/100