PecanProject / pecan

The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.

Home Page:www.pecanproject.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't find theme_border in PEcAn.visualization package

odiche97 opened this issue · comments

Bug Description

I want to use the theme_border function for a plot created using ggplot2. I installed the PEcAn package in RStudio using this code:

options(repos = c(
  pecanproject = 'https://pecanproject.r-universe.dev',
  CRAN = 'https://cloud.r-project.org'))

install.packages('PEcAn.all')

When I tried to use theme_border, I got the following error message:

Error in opts(panel.border = theme_border(c("bottom", "left"))) : 
  could not find function "opts"

I also checked the functions in PEcAn.visualization and also noticed that theme_border was not in the packages listed.

ls("package:PEcAn.visualization")
[1] "add_icon"    "ciEnvelope"  "map.output"  "plot_data"   "plot_netcdf" "vwReg"  

To Reproduce:

Use the following code:

df = data.frame( x=c(1,2,3), y=c(4,5,6) )
ggplot(data=df, aes(x=x, y=y)) + geom_point() + theme_bw() +
  opts(panel.border = theme_border(c('bottom','left')) )

Sidenote: I also read that the opts function had been discontinued so I also tried:

df = data.frame( x=c(1,2,3), y=c(4,5,6) )
ggplot(data=df, aes(x=x, y=y)) + geom_point() + theme_bw() +
  theme(panel.border = theme_border(c('bottom','left')) )

which gave me this error:

Error in theme_border(c("bottom", "left")) :  could not find function "theme_border"

Machine:

  • I am using a Windows computer with the RStudio version 2023.12.1+402

Our apologies, that is a small helper function that's not exported because it wasn't intended for general use. The code comes from https://groups.google.com/forum/?fromgroups#!topic/ggplot2/-ZjRE2OL8lE and we borrowed it (with attribution) long ago so can't comment on it's continued support within ggplot2. That said, you should be able to access internal functions by using the namespace an 3 colons (PEcAn.visualization:::theme_border)