Left aligning plots but keeping actual size - r

How to save multiple plots and keep their different actual-sizes on a same page (image below). arrangeGrob meets my requirement on keeping the actual size of each plot but it is not possible to align them left. plot_grid, ggarrange, and gtable provide horizontal aligning but these functions resize the plot.

Related

How to make sure the font stays the same when using ggsave

I'm trying to add multiple plots from ggplot into my Latex report. Most plots have different dimensions, as some need to be rectangle shaped, where as some need to be square shaped. To shape the plots, I've been changing the height and width parameters in ggsave. However, this also changes the font sizes. How do I have consistent font sizes for all my plots, and also be able to change the width and height of each plot separately?
I've already specified the font size in the plot using theme(text = element_text(size=5)), but it doesn't seem to actually stay consistent between the plots.

Highcharts: how to make y-axis labels CSS sticky?

I have a long data grid that is a combination of a normal html data grid (table) and highcharts horizontal bar charts (1 per row). The TH elements in the table grid are position sticky, and I want the corresponding y-axis labels to have the same behavior. Basically when the user scrolls the table the highcharts y-axis labels scroll up and then "pin" to the top of the view, with teh data grid rows scrolling beneath it.
I can't figure out how to control the y-axis labels to force them to obey position sticky... probably because they're rendering in SVG. Is this possible? Is there a way to replicate the concept of position sticky for highcharts axis labels?

Is there a way to make a ggplot legend resize to the width and length of the viewport it is in?

I am building a grid of geom_treemaps. There are 2 plots, side by side in one row. I want to have the legend (a continuous color gradient) span underneath the length of the entire window. To do this, I am extracting the legend from another geom with get_legend(plot) and drawing it in its own viewport. When I draw the legend, it shows no regard for the constraints of the viewport. I can adjust the legend.key.width parameter in the theme() of the plot I extracted the legend from, but that process is very manual. Is there a way to coerce this legend to fit (specifically lengthwise) into a viewport?
Thank you for any responses.

Set width and height of graphic made using ggplot, grid, and gridExtra

If I have a graphic composed of several plots, say three plots arranged vertically. This is a gtable object and can be drawn to the page with:
grid::grid.newpage()
grid::grid.draw(plot)
However I see that the plot in my RStudio is 'smushed up' as in the screenshot below:
As you can see in the bottom right corner it is squashed and the titles overlap with other elements of the graphic.
If I hit zoom and view the plot it is a lot bigger:
Now I know, that if I were to export my gtable plot using pdf() or png() and such devices, I can set a width and a height, and so just make it big enough such that the plot is not squashed.
However, instead of one of those graphic devices, I would like to use export.grid, from the gridSVG package to save it to an SVG file. But if I do
gridSVG::export.grid(plot)
Then the SVG file exported looks squashed as it does in the RStudio plot window.
So my question is, how can I manipulate the dimensions of the graphic so it is drawn to SVG without it looking squashed? I draw the plot initially with grid.newpage and grid.draw, I wonder perhaps I have to specify some size of the page or drawing using grid.
Thanks,
Ben.

Javafx chart show more empty space

I am customizing the javafx charts a bit adding valuelabels etc above bars and sliding out certain parts of piecharts. The problem is some of the extras come outside of the visual area.
Is there a simple way to get piecharts to become smaller (but the chart component itself retain its size so that there is more empty space surround the pie?
The same issue with barcharts. I need more empty space above my vertical bars, and more empty space to the right of my horizontal bars.
All data in the table has Number(mostly BigDeicmal) for its value and String for its key and series.

Resources