Question

Im using facet_grid on two variables to plot my data. Because it should still look as one big dot map, I have set the panel.margins very to a very low value. When I now draw my map with the following theme settings:

theme(plot.margin = unit(c(0,0,0,0), units = "lines"),
     panel.grid.major = element_line(size=0.05, colour="grey50"), 
     panel.background = element_rect(fill="black"), 
     panel.margin = unit(0.02,"lines"),
     panel.border = element_rect(fill=NA),
     axis.ticks = element_blank(),
     axis.text.x = element_text(angle = 270, hjust = 0, colour = "grey20", size=8),
     axis.text.y = element_blank(),
     strip.text = element_text())

this is the result:

enter image description here

As you can see the strips between the different facets of the map seem not to be even. When I differ the plot size, these "thicker" lines appear at different places. Unfortunately Im not able to find a size setting where they look all the same. It is not a problem of my display. Im not sure if this is a problem of ggplot or rstudio, the frontend im using. Has anyone an explanation for this and maybe even a solution? Thanks alot in advance!

Was it helpful?

Solution

Most likely it is an artefact, like baptiste suggested. Setting the background to a dark Colour solves the problem, however I would like to stick to my layout with a bright background. I tried saving it in different formats, and e voila, .svg did the job: no more artefacts remain visible. Thanks alot for your help!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top