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
#| label: fig-just#| echo: false#| fig-width: 4.5#| fig-asp: 0.5#| out-width: "60%"#| fig-cap: >#| All nine combinations of `hjust` and `vjust`.#| fig-alt: >#| A 1x1 grid. At (0,0) hjust is set to left and vjust is set to bottom. #| At (0.5, 0) hjust is center and vjust is bottom and at (1, 0) hjust is #| right and vjust is bottom. At (0, 0.5) hjust is left and vjust is #| center, at (0.5, 0.5) hjust is center and vjust is center, and at (1, 0.5) #| hjust is right and vjust is center. Finally, at (1, 0) hjust is left and #| vjust is top, at (0.5, 1) hjust is center and vjust is top, and at (1, 1) #| hjust is right and vjust is bottom.vjust<- c(bottom=0, center=0.5, top=1)
hjust<- c(left=0, center=0.5, right=1)
df<- crossing(hj= names(hjust), vj= names(vjust)) |>
mutate(
y=vjust[vj],
x=hjust[hj],
label= paste0("hjust = '", hj, "'\n", "vjust = '", vj, "'")
)
ggplot(df, aes(x, y)) +
geom_point(color="grey70", size=5) +
geom_point(size=0.5, color="red") +
geom_text(aes(label=label, hjust=hj, vjust=vj), size=4) +
labs(x=NULL, y=NULL)
The text was updated successfully, but these errors were encountered:
There is already the figure below that shows a very similar thing. I like that the text has two lines that makes it easier to see the justification, but it also adds a degree of visual clutter.
We're taking the following figure out of R4DS to save space and thought it might be a useful addition to https://ggplot2.tidyverse.org/articles/ggplot2-specs.html.
The text was updated successfully, but these errors were encountered: