teunbrand.bsky.social
GitHub: https://github.com/teunbrand
91 posts
838 followers
81 following
Regular Contributor
Active Commenter
comment in response to
post
This is great! Saw it in the revdepcheck, but hadn't gotten around to sending out all the messages yet
comment in response to
post
Axis labels are displayed for major breaks only. The minor breaks don't display labels.
comment in response to
post
This is also the way I'd go about this for single plots. For generalising, I'll predict that multi-line labels are horrible and having to tweak the offset for label widths for every plot.
comment in response to
post
I agree that it indeed would be nice to have this for styles and the options you present sound reasonable :)
comment in response to
post
Have you also tried this? No subtitle or theme element needed
```r
scale_colour_manual(
values = c(setosa = "#93263E", virginica = "#3947A4", versicolor = "#C6A634"),
guide = guide_marquee("{.setosa *I. setosa*} - {.versicolor *I. versicolor*} - {.virginica *I. virginica*}")
)
```
comment in response to
post
Must be a pain to calculate all the little point offsets to have the arrows not start inside the pie! 😱
comment in response to
post
There are some links here:
github.com/ggplot2-exte...
Custom legends can be made using `ggplot2::guide_custom()`.
comment in response to
post
I don't know of an easy incantation but you'd modify the style to add a new tag:
```r
style <- classic_style() |>
modify_style("big", size = 32)
```
And then you can use the geom as follows:
```r
geom_marquee(
aes(..., label = "I'm {.big big} text"),
style = style
)
```
comment in response to
post
Aside from the annotations, I think you could also use the following theme options to make 'before' closer to 'after':
```r
theme(panel.border = element_rect(fill = NA),
plot.title.position = "plot")
```
comment in response to
post
There was a tables section in the last release post
www.tidyverse.org/blog/2024/09...
comment in response to
post
Next version will get a manual stat that can save you some typing!
```r
library(tidyverse)
ggplot(economics_long, aes(date, value01, colour = variable)) +
geom_path() +
geom_text(
aes(label = variable),
stat = "manual",
fun = ~ slice(.x, which.max(x))
)
```
comment in response to
post
Same as this I suppose, but using `ggplotGrob()` instead of the `patchworkGrob()`.
bsky.app/profile/teun...
comment in response to
post
Also coming in the future:
```r
theme(
panel.widths = unit(50, 'mm'),
panel.heights = unit(50, 'mm')
)
```
comment in response to
post
Maybe because `ggsave(dpi)` is wrong, setting it to `dpi = 96` appears to be about right.
comment in response to
post
In theory, you should be able to do the following:
```r
b <- patchworkGrob(p)
w <- sum(grid::convertWidth(b$widths, "mm", TRUE))
h <- sum(grid::convertHeight(b$heights, "mm", TRUE))
```
However, in practice, this seems 3-4 mm too large.
comment in response to
post
I'm glad you found it useful!
comment in response to
post
Are there other examples of this?
comment in response to
post
ggplot2 needn't be compatible with S, so it mirrors CSS instead: www.w3schools.com/css/css_marg...
comment in response to
post
What should it have said instead though?
comment in response to
post
I’ve always assumed it’s terrible on purpose to make people customize their plots
comment in response to
post
library(ggarrow)
ggplot(whirlpool(5), aes(x, y, colour = group)) +
geom_arrow(stroke_colour = "black")
comment in response to
post
My two cents:
bsky.app/profile/teun...
comment in response to
post
Something similar for sure:
bsky.app/profile/teun...
comment in response to
post
Doesn't `enexprs()` instead of `enquos()` work? AFAICT, you're not using the quosure environment, so why not capture just the expression
comment in response to
post
library(legendry)
histogram_guide <- compose_sandwich(
middle = gizmo_histogram(just = 0),
text = "axis_base",
position = "bottom"
)
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
ggplot(nc) +
geom_sf(aes(fill = AREA)) +
guides(fill = histogram_guide)
comment in response to
post
Good luck on the new endevour!