ggplot2 - autosize chart and axis titles - r

I have create some ggplot2 bar plots which print fine to screen. When I print in PDF device, however, the chart and axis titles are too large - they sometimes extend past the left and right of the x-axis. None of these charts have any opts() set aside from title/axis-title - its all the defaults. What am I missing here? Is there a way to tell ggplot to auto-size this text so that the charts look good in PDF? Can I do this without explicitly setting opts()?

The best solution I can think of is to create a function to create a theme (like theme_bw()) and give it enough parameters so that its smart about sizing. Will keep this post open for a few days to see if there are any other clever ideas

Related

Vega-lite kibana autosize with concat not working

I am trying to concatenate views using hconcat with vega-lite (4.17) in kibana (7.12). So far so good, however when I set autosize to none (as requested in kibana vega-lite) my plots disappear. If I set the autosize to pad (or even fit), the plots can be seen but with two horizontal bars showing two errors: Width "container" only works for single views and layered views, and the same error for height. I am not sharing any code here because it does work in vega editor, but not in kibana. At this point, I am just hoping for a workaround, so any ideas will be more than welcome! Thanks!
(Just for reference here is a ss of the errors)

Viewer pane is printing in the wrong dimensions

My plots are showing up with the titles way too zoomed it. They are printing like my available space is much smaller than it really is. It was working fine before. I've tried to reset it with dev.off() and par(mfrow=c(2,2)).
plot(mtcars$mpg)
Do you see how the dimensions are weird? I've also tried to clear the preivous plots.
This is the same plot printed on another computer with the viewerport set to about the same size.

Use mouse to manually adjust geom_text() position?

Just wondering if there is any package/functionality to manually manipulate the positioning of text from geom_text()? I've been using ggrepel::geom_repel_text() for positioning without overlap, which is good for most cases, but when I have a ton of points all clustered in a tight space it would be much easier to just move them around without having to figure out the coordinates associated with each spot. Is this possible?
In case your problem relates to deciding which points to label, here's a Shiny app which allows for manual selection of points to label in a ggplot. It relies on ggrepel to space them, so if you want manual control, Marius makes a good suggestion.
https://github.com/AliciaSchep/gglabeller

prevent overlapping x-labels without stretching the graph too much

I am making a graph using ggplot however my x-axis labels are overlapping.
see both graphs here: https://imgur.com/a/D1HsVlA
I have looked online and found out that changing the width through save as image option seems to do the job however this stretches my graph a lot horizontally. Is there a way to prevent x axis labels from overlapping without tremendously stretching out my graph?

Google Sheets Graph - How to remove vertical captions

How can I remove the text that is vertically written for every bar in this google sheets graph?
This might be a stupid question but I looked everywhere and couldn't figure it out.
Thank you.
Edit: As it was asked for, here is a link to the sheet. I created a dummy version of the graph, as the original document contains sensitive information.
https://docs.google.com/spreadsheets/d/1dm7sJNNv_1OxNSjfEd699V2mZ6Q7Plm57yqnIk7bLMc/edit?usp=sharing
These vertical labels are X-Axis labels, not (as suggested by the comment from #tehhowch) Data Labels. Go to the Chart Editor and turn them off here:

Resources