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
Unequal panel border size #670
Comments
This bug was fixed in version 0.9.2. |
The bug had to do with the order that panel elements were drawn. Also, you'll probably need to use |
Ok. I've updated to 0.9.2.1, but still have the same issue. Am I doing it right ?
|
That should be right... Can you post a picture somewhere, say on imgur.com? |
It's pretty much the same than the one in the thread... 2012/9/21 Winston Chang notifications@github.com
|
I think this is probably happening because of the lack of anti-aliasing when this is rendered with the Windows graphics device. (This image looks like it was made in Windows.) The lines, pre-rendering, don't align perfectly with the pixels locations in Windows. See this for more information: If you don't want to use that solution, you may be able to get it to look better by fiddling with different values for the line thickness. You might also try different values for |
I'm not sure it is only anti-aliasing. When I render the plot with
And open the graph in Inkscape, the borders are still unequal (same for pdf). However, If I ungroup the elements, at a certain point the borders appear equal. It seems that one of the clip path is not correctly aligned with the width of the stroke ( |
I confirm that I observe the same behavior if I render under linux (ubuntu). |
I can confirm this bug in 0.9.3 on Linux.
in different formats: |
I thought I replied to this thread, however it seems I can't find my reply. It looks like the cliping window is too tight. In your svg, ( So on top and left side, you end up with a smaller stroke. in the svg, if Etienne 2013/1/30 nfdisco notifications@github.com
|
The SVG and PNG have unequal border sizes, but the PDF looks OK to me. When I run the same code on my Mac, the lines all look the same. Not sure what's causing this... Can you post images with thicker lines: qplot(1, 1) + theme(panel.border=element_rect(fill=NA, size=2)) |
I think it's just less obvious, but it's still there :
https://www.dropbox.com/s/y09nztarublyzzv/panel.border.tick.pdf As you mentionned, pdf doesn't seem to be affected. Etienne 2013/1/30 Winston Chang notifications@github.com
|
The PDF is affected. In the one I uploaded, the lines should be the same width as the major grid lines and instead they are thinner. It seems that is not affected because all four sides are affected, so they all look the same. I noticed that which sides of the rectangle are affected changes in a seemingly random fashion depending on things such as the line width, the size of the plot, maybe also the order of the arguments passed to theme... |
Hi, the problem is self-evident in the following picture:
(The inner rectangle is for reference.) The panel border is clipped. The code responsible for this can be found in facet-null.r:
Change the "on" to "off" and the clipping disappears: |
The origin of the problem seem to be to be that frame and clip don't share 2013/1/31 nfdisco notifications@github.com
|
But why do you want to clip? With clipping the line width will always be wrong, even if the clip area and frame are perfectly aligned.
|
|
Not possible at the moment, but if you want sharp corners this is not the way to do it. Also, be aware that all other rectangular elements in the plot have round corners. |
Clipping keeps all sorts of other elements inside the plot. It's not a trivial change unfortunately. |
I think I have got a solution, basically add the panel border in the appropriate gtable cell afterwards without clipping. I think this will still clip the other elements inside the plot, although I'm not familiar with gtable so I can be wrong. --- ggplot2/R/facet-null.r.orig 2013-01-31 16:29:42.037012615 +0100
+++ ggplot2/R/facet-null.r 2013-02-02 17:46:21.506877897 +0100
@@ -46,8 +46,8 @@
# Flatten layers - we know there's only one panel
geom_grobs <- lapply(geom_grobs, "[[", 1)
- panel_grobs <- c(list(bg), geom_grobs, list(fg))
-
+ panel_grobs <- c(list(bg), geom_grobs)
+
panel_grob <- gTree(children = do.call("gList", panel_grobs))
axis_h <- coord_render_axis_h(coord, range, theme)
axis_v <- coord_render_axis_v(coord, range, theme)
@@ -63,7 +63,8 @@
respect = respect, clip = c("off", "off", "on", "off"),
z = matrix(c(3, 2, 1, 4), ncol = 2, byrow = TRUE)
)
- layout$layout$name <- c("axis-l", "spacer", "panel", "axis-b")
+ layout <- gtable_add_grob(layout, fg, t=1, l=2, z=2, clip="off")
+ layout$layout$name <- c("axis-l", "spacer", "panel", "axis-b", "panel-border")
layout
} |
Unfortunately, faceted plots are also affected and those are more difficult to fix. |
This sounds like a great feature, but unfortunately we don't currently have the development bandwidth to support it. If you'd like to submit a pull request that implements this feature, please follow the instructions in the development vignette. |
Since I haven't found a solution, I think it could be considered as a bug.
I have a double thick line on the bottom and right borders of the panel when I plot the following code. In fact, it seems like it appears in every device, only that in vector devices it's less obvious.
The text was updated successfully, but these errors were encountered: