[R] How to set colors, axis gap, and free scale in ggplot?
Luigi Marongiu
m@rong|u@|u|g| @end|ng |rom gm@||@com
Tue Feb 22 15:25:09 CET 2022
I am trying instead to increase the size with `theme(strip.text.x =
element_text(size = 10))` (evem from 1 onwards) or `theme(strip.text.x
= element_text(face = "bold"))` but it gives an error (same in both
cases, even when using `strip.text`):
```
No summary function supplied, defaulting to `mean_se()`
No summary function supplied, defaulting to `mean_se()`
No summary function supplied, defaulting to `mean_se()`
No summary function supplied, defaulting to `mean_se()`
No summary function supplied, defaulting to `mean_se()`
No summary function supplied, defaulting to `mean_se()`
No summary function supplied, defaulting to `mean_se()`
No summary function supplied, defaulting to `mean_se()`
Warning messages:
1: Ignoring unknown parameters: fun.y
2: Removed 24 rows containing non-finite values (stat_summary).
3: Removed 24 rows containing non-finite values (stat_summary).
4: Removed 24 rows containing missing values (geom_point).
On Tue, Feb 22, 2022 at 12:41 PM Ron Crump <r.e.crump using warwick.ac.uk> wrote:
>
> Hi Luigi,
>
> > # FROM HERE IT DOES NOT WORK
> > facet_grid(. ~ Species, scales="free_y") + # THE SCALE IS FIXED FOR ALL PANELS
>
> I don't think you can force facet_grid to do this: the y scale will
> always be fixed within a row (unless someone else tells you differently,
> I may have misunderstood this) - this is to allow easy comparison and,
> consequently, comprehension of the graphic as you scan across a row.
>
> You can achieve what you want with:
> facet_wrap(~ Species, nrow = 1, scales = "free_y")
> but for the reason above, I'm not sure it's a good thing to do.
>
> > scale_colour_manual(values = c("palegreen4", "orangered3")) # THE
> > COLORS ARE AUTOMATIC
>
> You're setting the colour manually - which relates to lines, not fill
> and you have no colour aesthetic set, just a fill one.
>
> Use scale_fill_manual(values = c("palegreen4", "orangered3")) instead.
>
> > I would also like to increase the size of the axis labels and the
> > title size of the panels.
> > What is the correct syntax?
>
> See ?theme - you are interested in axis.title (maybe axis.title.x,
> axis.title.y) and strip.text (the labels for the facets). See also
> ?element_text as in theme, you basically want to put something like
> axis.title = element_text(...), replacing ... with the settings you
> want.
>
> For help specifically on ggplot2 and other tidyverse packages, I'd
> recommend using https://community.rstudio.com in the future.
>
> Best wishes,
> Ron.
>
--
Best regards,
Luigi
More information about the R-help
mailing list