Closed crew102 closed 7 years ago
Thanks Chris. Do you think it'd make sense to add the margins space as a parameter?
Not sure, what do you think? Have users asked for more control over things like that?
No, but I was thinking it might be a good idea instead of making an "arbitrary" decision for the user. But I also hate having too many options and complexity.. so let's leave it for now, maybe in the future someone will ask for it :)
Dean Attali President & CEO AttaliTech Ltd http://AttaliTech.com http://attalitech.com
On 14 May 2017 at 19:11, Chris Baker notifications@github.com wrote:
Not sure, what do you think? Have users asked for more control over things like that?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/daattali/ggExtra/pull/57#issuecomment-301346513, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6IFCS_EXdVCfrSKsWfz9P0KbrvD56Fks5r54o0gaJpZM4NacmQ .
Can we have this parameter to adjust the margin please? Or at least a way to revert it back to zero? .25cm is too much for what I need.
I don't mind adding this. @daattali, thoughts?
@lukauskas thanks for your feedback! My only reservation is parameter-overload. Can you show a screenshot of what it means that it's too much?
Well I understand that my case is an edge one, so it might not be necessary for most users. However, I still believe it would be a nice-to-have.
I discovered this when I was working on a 4x4 cm figure (in scientific papers you sometimes are very limited on space and need to get creative...). I am a bit wary to waste .25cm on the margin here. But this is not the problem.
It would mind this (and just increase the plot size to 4.25 cm instead) Except it was doing it only on one side of the plot, making it assymetric. Initially I thought this margin was cropping one of my boxplots on the right, but that turned out to be an issue with pdfDevice instead. Which also makes me want to suggest to have a parameter for a margin between the marginal plots and the side.
Here's some code that reproduces a similar use case:
require('ggplot2')
require('ggExtra')
p <- ggplot(mtcars) +
geom_point(aes(wt, mpg), color = 'red')
p <- p + theme_linedraw(base_size=4)
p <- p + theme_light(base_size=4)
p <- p + theme(panel.border=element_rect(size=1.0,
fill=NULL,
color='black'),
axis.text.x=element_blank(),
axis.text.y=element_blank())
ggsave('test.nomargins.png', plot=p, width=4, height=4, units='cm')
p <- ggMarginal(p, type='boxplot')
ggsave('test.margins.png', plot=p, width=4, height=4, units='cm')
This is how it looks without margins:
and how it does with the margins:
So there are three problems with this plot at this scale, that my example does not do justice for
Ideally I would like to adjust all three margins myself.
I ended up hacking your code in my own fork to change all four margins to 1pt (from 0, 0, .25, .25 cm) and it worked best for me. To this day I couldn't find how to add some padding between the boxplot and the figure borders (however the pdfDevice
works fine and does not crop things if you give dimensions in inches, not cm
) .
So, yeah. If you are worried about feature overload, can you maybe post an official 'workaround' way of doing it for people like me?
I think adding an official way to monkeypatch the package is worse than simply adding support.
Feel free to open an issue and link to here
This should close #49. Previously margins looked like this:
Now .25 cm is add to the left and bottom margins, to make graphs look like this: