DependenciesGraphs icon indicating copy to clipboard operation
DependenciesGraphs copied to clipboard

data.graph.script interprets '#' characters in hex colour codes as commented lines

Open LockStoch opened this issue 5 years ago • 1 comments

Applying data.graph.script() will strip all comments but also strips lines with '#' inside strings such as used in hexadecimal color codes (e.g '#ededed'). Consequently, the code will run into syntax errors.

Example:

  p <- ggplot(data, aes(x=site, y=value)) +
    geom_boxplot(outlier.alpha=.5, fill='#ededed') +
    # add threshold lines
    geom_hline(aes(yintercept=y), data=lines, linetype='dashed', 
               color='#d93d11', size=.3) +
    labs(x=NULL, y=longname.clim.ylab(var, thresh)) +
    ggtitle(title) +
    theme_classic() +
    ggthemes.custom('theme_border') +
    theme(axis.text.y.right = element_text(color = "#d93d11", face='bold', size=12),
          axis.ticks.y.right = element_blank())

Becomes:

 p <- ggplot(data, aes(x=site, y=value)) +
   geom_boxplot(outlier.alpha=.5, fill='
   
   geom_hline(aes(yintercept=y), data=lines, linetype='dashed', 
              color='
   labs(x=NULL, y=longname.clim.ylab(var, thresh)) +
   ggtitle(title) +
   theme_classic() +
   ggthemes.custom('theme_border') +
   theme(axis.text.y.right = element_text(color = "
         axis.ticks.y.right = element_blank())

In the temp.file.dep.graph.R file.

LockStoch avatar Nov 10 '20 04:11 LockStoch

I think the issue occurs inside script.like.fun(path, path.temp) during the read in process read.table(path, sep = "\n", quote = "")$V1.

LockStoch avatar Nov 10 '20 04:11 LockStoch