-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using graph2ppt()
with {showtext}
#45
Comments
Hello @SchmidtPaul, Sorry for the very late answer. Hopefully this hasn't blocked you from generating your reports.... Here are my thoughts on your questions:
|
Hi, thanks for the answer! First of all, I realized that the (3.) was actually more of a {showtext} issue and was addressed in yixuan/showtext#51. Here is a reprex that works fine for all library(export)
library(ggplot2)
p <- ggplot(data = PlantGrowth,
aes(y = weight, x = group)) +
geom_point() +
labs(subtitle = "Here is also a subtitle",
caption = "And here is a caption")
p1 <- p + ggtitle("Without showtext::showtext_auto()")
ggsave("p1.pdf", p1)
#> Saving 7 x 5 in image
ggsave("p1.png", p1)
#> Saving 7 x 5 in image
graph2doc(p1, "p1.docx", vector.graphic = TRUE)
#> Exported graph as p1.docx
graph2ppt(p1, "p1.pptx", vector.graphic = TRUE)
#> Exported graph as p1.pptx
showtext::showtext_auto()
p2 <- p + ggtitle("With showtext::showtext_auto()")
ggsave("p2.pdf", p2)
#> Saving 7 x 5 in image
ggsave("p2.png", p2)
#> Saving 7 x 5 in image
graph2doc(p2, "p2.docx", vector.graphic = TRUE)
#> Exported graph as p2.docx
graph2ppt(p2, "p2.pptx", vector.graphic = TRUE)
#> Exported graph as p2.pptx Created on 2022-07-29 by the reprex package (v2.0.1) For comparison, here are screenshots of all exported Again, the font size/dimension thing can be ignored for now since all |
Hmm indeed this is not expected. When I run your example However, I cannot explain why the PDF resolution is different... Does it lead to the same with |
I have the same problems, but now they happen even when I don't use "showtext". I get all the cut-out sections of the font filled with black. |
Can you give a reproducible example perhaps? |
It's the same as the original post in this thread: #45 (comment). I realize now that if I started a new R session that had never run or called But I was having the exact same issues mentioned here, the same as the second reprex too. I managed to fix this issue by using
|
Hi, thanks for the package - been using it for a while now.
I recently started using {showtext} to make use of extra fonts in my ggplots. However, I noticed that after running the required
showtext::showtext_auto()
, the exported.pptx
have issues with their text - see the screenshot below.Created on 2022-01-19 by the reprex package (v2.0.1)
This is a Screenshot of
Rplot.pptx
:Ultimately, I have these questions:
graph2ppt()
?pptx
in the first place is to get the figures in mydocx
files to be as crisp-looking as possible. I achieve this via copying the graph from thepptx
file and pasting it into word as an enhanced metafile. Does this sound reasonable to you or do you have a better suggestion?pdf
,png
andpptx
. The first two I could do viaggsave()
, but I actually only do so for pdf and subsequently runpdftools::pdf_render_page(pdf_path, page = 1, dpi = 300) %>% png::writePNG(bitmap, png_path)
(see my custom export function). This seems to do the trick of always having the same font sizes and scales for both of these two exported files. Does this sound reasonable to you? Should I try to take a similar approach here with e.g.pdf2pptx::pdf2pptx()
?The text was updated successfully, but these errors were encountered: