I have a function with multiple optional arguments to modify a plot using ggplot2. If any of these argument is missing, I want to use theirs default values in ggplot2. If there is only one argument, this can be done like:

```
simple_plot <- function (color) {
   p <- ggplot(mtcars, aes(cyl, mpg))

   if(!missing(color))
   {
      p <- p + geom_point(col = color)
   } else {
      p <- p + geom_point()            # use its default if the argument is missing
   }
}

```

However, this is not a good solution when there are multiple arguments to modify the plot's point shape, fill, axis titles, breaks, limits, etc. Is there a better way?

[Edited to clarify my question]
Thanks for those who have responded to my questions. I would like to clarify my question by including the following codes. There will be more than one function to call and each function has multiple arguments. It doesn't seem using `do.call` is an easy way to implement.

```
better_plot <- function(col.y1, shape.y1, col.y2, shape.y2,
                        title.y1, breaks.y1, title.y2, breaks.y2, title){

  p <- ggplot(mtcars, aes(x = cyl)) +

    # 1st y data points
    case_when(
      missing(col.y1) & missing(shape.y1) ~  geom_point(aes(y = mpg)),
      missing(col.y1) & !missing(shape.y1) ~  geom_point(aes(y = mpg), shape = shape.y1),
      !missing(col.y1) & missing(shape.y1) ~  geom_point(aes(y = mpg), col = col.y1),
      !missing(col.y1) & !missing(shape.y1) ~  geom_point(aes(y = mpg), col = col.y1, shape = shape.y1)
    ) +

    # 2nd y data points
    case_when(
      missing(col.y2) & missing(shape.y2) ~  geom_point(aes(y = hp)),
      missing(col.y2) & !missing(shape.y2) ~  geom_point(aes(y = hp), shape = shape.y2),
      !missing(col.y2) & missing(shape.y2) ~  geom_point(aes(y = hp), col = col.y2),
      !missing(col.y2) & !missing(shape.y2) ~  geom_point(aes(y = hp), col = col.y2, shape = shape.y2)
    ) +

    # y axises - labels and breaks
    case_when(
      !missing(title.y1) & !missing(breaks.y1) & !missing(title.y2) & !missing(breaks.y2) ~ 
        scale_y_continuous(
          name = title.y1, breaks = breaks.y1,
          sec.axis = sec_axis(name = title.y2, breaks = breaks.y2)),

      !missing(title.y1) & !missing(breaks.y1) & !missing(title.y2) & missing(breaks.y2) ~ 
        scale_y_continuous(
          name = title.y1, breaks = breaks.y1, 
          sec.axis = sec_axis(name = title.y2)),

      !missing(title.y1) & !missing(breaks.y1) & missing(title.y2) & missing(breaks.y2) ~ 
        scale_y_continuous(
          name = title.y1, breaks = breaks.y1),

      .... # the remaining combinations...

    )

  # add plot title if any
  if(!missing(title)) p <- p + ggtitle(title)

  return(p)
}

```