0

I'm working with a dataset and I want to set different limits for "y" axis, depending on the "Level" which the graph will be faceted by.
I tried to create a dataframe containing column-list that contains, in each row, a vector of length 2 that represents my maximum and inferior limit and a column with "Level" data (the column which is being used to facet_wrap(), then I tried to set the limits in this part of my code:
lims(data = lim_df_agg_sub, aes(y = Limites_y, x = c(NA, NA)))
Where:

  • lim_df_agg_sub is the dataframe containing the limits and levels;
  • Limites_y is the column list containing a vector of length 2 with maximum and minimum limit.

The error I got from Rstudio is Error: All arguments must be named, adn when I run rlang::last_error(), it shows me this message:

All arguments must be named
Backtrace:
1. ggplot2::lims(...)

Is there any way to do what I want?

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
  • @starja thanks for aswering! The answer that you provided helped me to free scales when I have a faceted graph, thanks for this by the way. But what I want to do is to set minimum and maximum values for "y" axis, to facet them. I'll answer in 2 parts, otherwise I can't publish my answer. – caio.valente14 Jul 17 '20 at 14:44
  • @starja , for exemple, it's not always my graph will be faceted by Levels, but when it happens I would like to be able to use some dataframe I created with the limits for "y" axis and the levels of facetting so I can pass this data frame like this, for exemple (I know it won't work, I already tried, rs) `lims(data = df, aes(y = lim_y))`. Then, with `facet_wrap()`, I could facet the these limits according to the column "Level" I have in the dataframe "df". OBS: The problem is not with the conditional, to facet or not, but with the limits I want to set, everything else is working fine! – caio.valente14 Jul 17 '20 at 14:46

0 Answers0