Closed timelyportfolio closed 2 years ago
I just realized I am on a computer so updated R to 4.1.2
. Unfortunately, the problem still occurs.
I don't see this on MacOS, but I have an inkling on why this might be happening.
Could you try an earlier version (prior to 'fastpath' being added) and see if this still happens?
Try this commit: 594e6b965ecf018c71fc21af07dbebda661e29cb
Current theory:
@coolbutuseless Using https://github.com/coolbutuseless/ggsvg/commit/594e6b965ecf018c71fc21af07dbebda661e29cb fixes the issue. Makes sense and thanks for the explanation. Let me know if I can help debug or test.
To add another example to the mix, here is what I was trying to achieve when I discovered the problem.
library(ggsvg)
library(ggplot2)
arrow_url <- "https://www.svgrepo.com/download/102966/arrow-pointing-to-up.svg"
arrow_svg <- paste(readLines(arrow_url), collapse = "\n")
# add rotate transform to be populated from data
# more robust with xml2 but just use gsub for now
arrow_svg_with_rotate <- gsub(
x = arrow_svg,
pattern = "viewBox=",
replacement = "transform = 'rotate({{rotate}}, 16, 16)' viewBox="
)
dat <- data.frame(
x = 1:20,
y = 1:20,
rot = seq.int(from = 0, to = 360, length.out = 10)
)
ggplot(dat) +
geom_point_svg(
mapping = aes(
x = x,
y = y,
rotate = rot
),
defaults = list(rotate = 0),
svg = arrow_svg_with_rotate,
size = 5
) +
# to test rotate origin; used 16,16 since half of viewBox 0,0,32,32
# geom_point_svg(
# mapping = aes(
# x = x,
# y = y
# ),
# svg = arrow_svg,
# size = 5
# ) +
theme_bw()
Can you try: d765be2adace76269dcf0cbb279774e19fb0d5d8
I added code in the fastpath such that if SVG is the same for all points:
@coolbutuseless d765be2adace76269dcf0cbb279774e19fb0d5d8 works on my end.
Excellent. Closing.
I am so excited for this new functionality. All seems to work correctly until I attempt the cars example where only a subset of the cars are rendered. Each time I rerun the code I get a different subset of the data. No errors or warnings are produced.
I believe all the packages are on their most recent version. I get the same result regardless of graphics device that I choose.