Closed wch closed 8 years ago
@jiho @thomasp85 any ideas? Did clipping change?
clipping might have changed, but I'm unable to reproduce the look on my computer... I'll go through the old clipping specs and see if I can find anything. but I might need you to verify...
This is on my Ubuntu machine.
Can you check with the CRAN version and see if the look is ok there?
Hm, it looks different depending on the R version and graphics device. This is probably too much information, but here you go. For each of the code snippets, I'll include two screenshots: one for ggplot2 2.1.0 and one for the latest dev version, 2.1.0.9000 (1ee809a).
png()
in a terminalp <- ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
facet_grid(am ~ cyl) +
theme_bw()
# Using default png() settings
png('test-terminal.png', width = 600, height = 400)
print(p)
dev.off()
This is using Cairo::CairoPNG
for the output:
Cairo::CairoPNG('test-terminal-Cairo.png', width = 600, height = 400)
print(p)
dev.off()
This is what it looks like in the RStudio viewer pane if I just print it:
p
And this is what it looks like in RStudio if I click on Export->Copy to Clipboard:
I suspect the layering of objects has changed, and the different devices treat it differently.
If you're on a Mac and you want to get similar output to my png()
, I believe you need to run png(type="cairo")
.
Thanks - I'll dig into it tomorrow
The darker lines are my doing, so that they match the ticks. But the clipping definitely changed. For completeness here is the aspect with 2.1.0 (on left) and current master (on right) on OS X.
The clipping of the sides of the panel was already a bit "too much" in 2.1.0 but not as noticeable because the color was lighter. However, the outline of the facets used to be clipped too. And it was when I tested the color change in #1679 (see the second plot). With the outline not clipped, the aspect is indeed weird. This is also a problem with theme_classic()
, which has outlines on facet labels.
Ok, it's clear that this is my wrongdoing :-)
That said, if you could clip the content of the background panel + the grid lines (which need to be clipped of course) but not the outline of the panel or axes, it would make it easier to design themes. For example matching the thickness of the axes with the thickness of the grid lines is difficult/impossible now because axes are clipped and grid lines are not (basically one has to make axes twice as thick and even then, it is not an exact match). It will also help get a smoother, more homogeneous look in various rendering engines. As Winston's examples above show, with rendering engines which favour sharpness (i.e. not OS X's but nearly all others), the clipped lines can appear of different width depending how the rendering engine rounds the number of pixels. Finally, it also makes the outline of facet labels very square (because it is clipped) when one might want a smoother look, with rounded angles.
This would require some tweaking of the themes to keep the current aspect but we could easily do this in concert.
@wch Can you check out #1789. I did make an error with the new strip constructors so they weren't clipped, but apart from that I could not elicit any change by making stacking and clipping more explicit - I think the panel-border effect is simply an artefact of the new theme settings by @jiho and bad rendering...
The panels have a bit of a raised, 3-D look to them. Also, the thinner/lighter lines on the left side look a bit off when the facet label box has a darker/heavier line.