Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. I was messing around with some scale adjustments with my {ggblanket} package, and thought I’d share this as a post.

It’s by no means a complete demonstration of the functionality available.

But it demonstrates a bit of how x and y scales can be adjusted.. as well as some other stuff randomly thrown in.

```library(palmerpenguins)
library(tidyverse)
library(lubridate)
library(ggblanket)```

Note x scale default limits of min/max breaks and zero expanding

```economics %>%
gg_col(x = date,
y = unemploy)``` Make the theme horizontal lines only

```economics %>%
gg_col(x = date,
y = unemploy,
theme = gg_theme(y_grid = TRUE))``` Adjust limits of an x date variable to the min and max of the data

```economics %>%
gg_col(x = date,
y = unemploy,
x_limits = c(NA_Date_, NA_Date_))``` ```economics %>%
gg_col(x = date,
y = unemploy,
x_limits = c(NA_Date_, NA_Date_),
x_expand = c(0.05, 0.05))``` Make more breaks using the pretty algorithm with the x_breaks_n argument.

```economics %>%
gg_col(x = date,
y = unemploy,
x_breaks_n = 10)``` Make breaks using the scales::fullseq algorithm using the x_breaks_width argument.

```economics %>%
gg_col(x = date,
y = unemploy,
x_breaks_width = "3 years")``` Specify your own specific breaks. In this case, we are using the seq function and working backwards to ensure our last break is the maximum of the data. Note that if your breaks do not cover all of the data, you will need to specify limits of `c(NA, NA)` or `c(NA_Data_, NA_Data_)` to include all of the data.

```x_vctr <- economics %>% slice_head(n = 100) %>% pull(date)
x_breaks <- seq(from = max(x_vctr), to = min(x_vctr), by = "-19 months")

economics %>%
gg_col(x = date,
y = unemploy,
x_breaks = x_breaks,
x_limits = c(NA_Date_, NA_Date_))``` Use ggplot2’s default breaks, limits, labels and expand

```economics %>%
gg_col(x = date,
y = unemploy) +
scale_x_date()``` Convert to an area graph

```economics %>%
gg_area(x = date,
y = unemploy)``` Convert to a line graph

```economics %>%
gg_line(x = date,
y = unemploy,
size = 1)``` Add zero in the y scale

```economics %>%
gg_line(x = date,
y = unemploy,
size = 1,
y_zero = TRUE)``` Convert to a step graph. And colour by the y variable. Note no legend is provided, as it is the values can be read off the y scale.

```economics %>%
gg_step(x = date,
y = unemploy,
col = unemploy)``` Convert to a ribbon to show uncertainty

```economics %>%
gg_ribbon(date,
y = unemploy,
ymin = unemploy - 500,
ymax = unemploy + 500,
y_zero = TRUE) +
geom_line()``` Remove the outer lines

```economics %>%
gg_ribbon(x = date,
y = unemploy,
ymin = unemploy - 500,
ymax = unemploy + 500,
y_zero = TRUE,
pal = scales::alpha(pal_viridis_mix(1), 0)) +
geom_line(col = scales::alpha(pal_viridis_mix(1), 1))``` Change the y title

```economics %>%
gg_col(x = date,
y = unemploy,
y_title = "Unemployment")``` Remove the x title

```economics %>%
gg_col(x = date,
y = unemploy,
x_title = "")``` Alternative way to remove the x title.

```economics %>%
gg_col(x = date, y = unemploy) +
ggplot2::labs(x = NULL)``` For further information, see the ggblanket website.