Skip to content

ggsave saves plots into SVG format somewhat streched #4929

Closed
@SarenT

Description

@SarenT

SVG files generated by ggsave (tested on Ubuntu 18.04 LTS) are kind of stretched compared to the plots in RStudio or PNG format.
(R 4.0.3 ggplot2 3.3.6 svglite 2.1.0)

plot = ggplot(iris, aes(x = Species, y = Sepal.Length)) + geom_violin()
plot # RStudio
ggsave("test_ggsave.png", plot, "png")
ggsave("test_ggsave.svg", plot, "svg")

SVG files looks like this:
image
And the PNG file looks like this:
image
This is in RStudio:
image

I have removed the attribute lengthAdjust='spacingAndGlyphs' from text objects:
image

I think that this option could be the culprit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions