You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Things like background fill, font colour and face (italic, bold, etc.) that the user could control through facet.args or par2.
Would probably require that we role our own combination of rect and text, rather than simply going through mtext. But that shouldn't be too problematic. Proof of concept:
curve(dnorm(x), -3, 3, col="dodgerblue")
corners= par("usr") # Get the four corners of plot area (x1, x2, y1, y2)# top sideline_height= grconvertY(1.1, from="char", to="user") - grconvertY(0, from="char", to="user")
rect(
corners[1], corners[4], corners[2], corners[4] +line_height,
col="gray95", border=NA, xpd=TRUE
)
# mtext("Topside", side = 3, line = 0.1)
text(
x= mean(corners[1:2]),
y=corners[4],
"Topside",
adj= c(0.5, -0.5),
xpd=TRUE,
)
# right sideline_height= grconvertX(1.1, from="char", to="user") - grconvertX(0, from="char", to="user")
rect(
corners[2], corners[3], corners[2]+line_height, corners[4],
col="gray95", border=NA, xpd=TRUE
)
# mtext("rightside", side = 4, line = 0.1)
text(
x=corners[2],
y= mean(corners[3:4]),
"Rightside", srt=270,
adj= c(0.5, -0.5),
xpd=TRUE
)
Complementarity: There's no way to rotate the RHS facet mtext for facet_grid cases, so that it faces outwards. (Reason: it doesn't support a srt argument and las doesn't give us that either.) So we'd have to go through a bespoke text approach anyway (as above: using srt = 270 to rotate outwards).
Activity
grantmcdermott commentedon Jan 23, 2024
Complementarity: There's no way to rotate the RHS facet
mtextfor facet_grid cases, so that it faces outwards. (Reason: it doesn't support asrtargument andlasdoesn't give us that either.) So we'd have to go through a bespoke text approach anyway (as above: usingsrt = 270to rotate outwards).