Skip to content

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

Description

@LockStoch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions