-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Could functionality be provided to easily retrieve plot height and plot width neatly? #6367
Comments
The |
I like this idea, but I think we should stick with the interface that {grid} already provides; e.g. make a Secondly, we could consider letting |
get_plot_height
and get_plot_width
function be provided?
I basically just want an easy way to save plots with specified panel heights/widths neatly. Open to any way you think is best to achieve this. But prefer not to deal with grobs, if I can. The status quo method seems a bit complex for a relatively common use-case. Renamed the issue to make it less prescriptive |
One other thought: ideally the functionality could work with either a ggplot or patchwork object input |
We have been here before (though I can't find the other issues so you are forgiven for not knowing 🙂). There is a circular dependency between the graphics device and getting the dimensions of the plot, because the size of text is device dependent in a myriad of ways. Because of this you cannot reliably know apriori how big a plot is before opening the device and trying to plot it. This is usually not an issue because the flexible panel area expands or contracts to fill the space but once that has been fixed in dimensions you can at best make an educated guess as to how much space it takes up. Due to this uncertainty I have declined such functionality in ggplot2 as I don't want it to make promises it can't keep. There is probably room in an extension package for such functions though |
Awesome new feature re theme panel.widths and panel.heights!
Could ggplot2 provide
get_plot_height
andget_plot_width
functions to support saving plots where the panel.widths and panel.heights have been set.Basically, it'd be super useful, if I could do something like this:
The text was updated successfully, but these errors were encountered: