stefanedwards / lemon

🍋 Lemon --- Freshing up your ggplots
https://cran.r-project.org/package=lemon
GNU General Public License v3.0
180 stars 11 forks source link

Error with coord_capped_cart: Error in `*tmp*`[[i]] : attempt to select less than one element in get1index #26

Closed lnnrtwttkhn closed 4 years ago

lnnrtwttkhn commented 4 years ago

Hi, first: thanks for the great package. I am running into the same issue with several ggplot plots in a piece of older code:

Error in `*tmp*`[[i]] : 
  attempt to select less than one element in get1index

It always happens with the coord_capped_cart() command, e.g., when using

coord_capped_cart(left = "both", bottom = "both", expand = TRUE, ylim = c(90,100))

Since it's an older script I imagine it's due to some update that happened but I unfortunately did not keep track of the package version used before.

Please let me know if I can provide any additional information.

Any help would be appreciated!

Thanks and best!

lnnrtwttkhn commented 4 years ago

I found the culprit:

I need to add:

theme(panel.border=element_blank(), axis.line = element_line())

otherwise it always throws the error above (I also reproduced with the example code in the README).

Now I found this note in the README which explains it:

NB: Disable panel.border and enable axis.line in theme, otherwise you will not see an effect!

Will close this issue again.