ropensci/visdat

define my palette appear Error: could not find function "discrete_colours"

wanpingDou opened this issue · 5 comments

I try to use define_palette() to defind my ggthemr, but appear Error in discrete_colours(colours) : could not find function "discrete_colours"
so,I use ggthemr('flat')/ggthemr('flat')/ggthemr('pale')......ok

Hello - can you please post a reproducible example of this problem, I'm not familiar with the define_palette function from ggthemr

Hello - can you please post a reproducible example of this problem, I'm not familiar with the define_palette function from ggthemr

now ,is ok! like this:

library(ggthemr)
library(visdat)

tableau10 <- c('#AEC7E8','#FFBB78','#98DF8A',
    '#D62728','#FF9896','#C5B0D5','#C49C94',
    '#5E2C25','#F3C57B','#89F27A'
    )
tableau10 <- define_palette(swatch = tableau10,
    gradient = c(lower = tableau10[1L], 
    upper = tableau10[2L])
    )
ggthemr(tableau10)

dt <- data.frame(a=c(1,2,3,NA,5),b=c('1','2',NA,'4',NA))
vis_dat(dt)

Hi @wanpingDou ,

Is this what you would expect, from ggthemr?

library(ggthemr)
#> Loading required package: ggplot2
library(visdat)

tableau10 <- c('#AEC7E8','#FFBB78','#98DF8A',
               '#D62728','#FF9896','#C5B0D5','#C49C94',
               '#5E2C25','#F3C57B','#89F27A'
)

tableau10 <- define_palette(swatch = tableau10,
                            gradient = c(lower = tableau10[1L], 
                                         upper = tableau10[2L])
)
ggthemr(tableau10)

dt <- data.frame(a=c(1,2,3,NA,5),b=c('1','2',NA,'4',NA))
vis_dat(dt)
#> Warning: Removed 3 rows containing missing values (geom_raster).

Created on 2020-05-14 by the reprex package (v0.3.0)

Hi @wanpingDou ,

Is this what you would expect, from ggthemr?

library(ggthemr)
#> Loading required package: ggplot2
library(visdat)

tableau10 <- c('#AEC7E8','#FFBB78','#98DF8A',
               '#D62728','#FF9896','#C5B0D5','#C49C94',
               '#5E2C25','#F3C57B','#89F27A'
)

tableau10 <- define_palette(swatch = tableau10,
                            gradient = c(lower = tableau10[1L], 
                                         upper = tableau10[2L])
)
ggthemr(tableau10)

dt <- data.frame(a=c(1,2,3,NA,5),b=c('1','2',NA,'4',NA))
vis_dat(dt)
#> Warning: Removed 3 rows containing missing values (geom_raster).

Created on 2020-05-14 by the reprex package (v0.3.0)

Yes, my problem has been solved with the method above.THX boy.

OK great!