0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rで作ったsvgがLibreOffice Draw でインポートされない時

Posted at

問題

png_v_svg.png

学会ポスター作りにはLibreOffice Drawが簡単でいいですよね。しかし、Rで作ったsvgをLibreOffice Drawにインポートすると文字が消えてしまう怪現象に悩まされました。さらによくわからないのが、Rで作ったsvgでもうまくインポートされるものと、そうでないのがあるのです。

解決

R内蔵のグラフィックデバイスであるsvgを使うと問題ないのですが、svgliteで書き出したものは字が変になることが分かりました。ggplot2::ggsave()はsvglite::svglite()をsvgの書き出しに使うため、LibreOfficeで変になるのです。というわけで、ggsave()に以下の引数を加えたら、LibreOfficeで読めるようになりました。

ggplot2::ggsave(“hoge.svg”, device = svg)

環境

MacBook Pro (2015)
macOS 10.14.6
LibreOffice 6.3.3.2

R 3.6.1
svglite 1.2.2

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?