Git Product home page Git Product logo

palettes's Introduction

Michael McCarthy

R Python

Hi, I’m Michael, an R programmer and data scientist. My background is in psychology research, where I’ve studied topics ranging from attitude formation, to decision-making, to individual differences in brain function. Studying how people think and act has given me a deep appreciation for the human elements of data science. Much of our data is about humans. All of our data is communicated to humans. Understanding these relationships has been key to successfully navigating my role as a data scientist.

When I’m not pushing new commits to GitHub you can find me writing music in my studio, riding my bike on the local trails, or spending time with my friends and family.

Repository Overview

Community Contributions

Sites

Contact

palettes's People

Contributors

mccarthy-m-g avatar olivroy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

palettes's Issues

Plotting colours and palettes

Add a ggpalette() function that takes a palette or color as input and returns a ggplot themed like a swatch as output. Something like: https://images.app.goo.gl/j9Vu9NRJuC5vvMHr7

Doing this would also require creating as.dataframe() methods for the palette and color classes.

As far as handling multiple colours, facets would probably work well

Pretty display of colours

This can be accomplished using the crayon package; however, this may be unnecessary given that RStudio 1.6 might support this natively rstudio/rstudio#5424.

Edit: RStudio support seems to be for the editor pane, not output, so maybe still worth implementing myself

v0.2.0

These are issues or features that I am considering for v0.2.0. Some of these may be pushed back to later versions or not be included at all.

If you have suggestions, please create a new issue.

If you would like to contribute, please comment on the relevant issue.

Items

Release palettes 0.2.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • devtools::check_mac_release()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Export lighten and darken functions?

I notice that the code base has functions for lightening/darkening colour palettes and vectors but these are not exported. Any reason why not? They would be nice to have!

Bivariate colour interpolation (`pal_ramp_bibariate()`)

New function for creating bivariate colour palettes that can be used with the biscale package. Main points of consideration are:

  • Should the function take 4 colours as arguments (one for each corner of the palette), or 3 colours as arguments (with the 4th being interpolated based on the x and y colours)?
  • Should the number of dimensions be infinite, or should they be restricted? (this is more a practical question based on how well I can program something that generalizes well to higher dimensions, or if I can only create something nice for smaller numbers of dimensions)

Pretty print colour names in colour vectors

Since colours in colour vectors can be named, it might be nice to also output those names when they’re there (maybe as a muted grey colour in parentheses next to the hex code?).

I would probably exclude this when printing in tibbles though, because the output would be too wide there.

Add `create_` function

For developers to create a new palettes package with all the boilerplate set up.

Can probably wrap usethis::create_from_github() and hard code it to a template repository. Only catch is this would require an Internet connection.

Or I can try to build everything manually using the appropriate use_ functions. use_template() looks like it will fit the bill.

Add info text to `validate_colour()` error message

The info text would provide a hint on how to fix the error. Something like (as separate “i” bullets):

  • Is/Are your hexadecimal string/strings of the form “#rrggbb” or “#rrggbbaa”?
  • Is/Are your colour name/names included in grDevices::colors()?

It would be nice to make this context aware, so only the relevant hint shows up if invalid colours are specified in a single way, and both show up if there are both invalid hex strings and colour names.

Add compact `print_style` option

The skittle/smartie swatches for colour palettes in this paper look nice and it would be cool to have the option to print palettes in the console like on page 8, for users who might want a compact display.

It would be controlled with a new option (palettes.print_style?), and the implementation would basically just involve not printing the hex codes—only symbols—and restricting the number of colours to 10 per line before a line break.

The print styles could have the following names: “default” (the current style), “compact”. Or the default could just be NULL rather than an explicit value. Either way, using strings here would be a good idea rather than a boolean in case I want to add new print styles in the future.

New/Better Hex Sticker

{palettes} could use a better hex sticker! Open to contributions for this 😄

I made the current one using some lightly modified free to use vector graphics. It’s okay, but could be a lot better.

Add ggplot2 scale_ functions

Some examples here:

https://meghan.rbind.io/blog/2022-10-11-creating-custom-color-palettes-with-ggplot2/

https://www.garrickadenbuie.com/blog/custom-discrete-color-scales-for-ggplot2/

https://drsimonj.svbtle.com/creating-corporate-colour-palettes-for-ggplot2

These can also be used as default options with:

options(
  ggplot2.discrete.colour = function(...) scale_colour_viridis_d(..., begin = 0.15, end = 0.85),
  ggplot2.discrete.fill = function(...) scale_fill_viridis_d(..., begin = 0.15, end = 0.85),
  ggplot2.continuous.colour = function(...) scale_colour_viridis_c(..., begin = 0.15, end = 0.85),
  ggplot2.continuous.fill = function(...) scale_fill_viridis_c(..., begin = 0.15, end = 0.85)
)

Fix asciicast output in README

Right now the output in the README only shows the colour symbol and hex code, but it doesn’t show the <palettes_colour[1]> class above that like it’s supposed to (e.g., it should look how the pal_palette() output looks).

What is the `pal_brewer` function?

Hi Michael,

I'm working through the code in the Creating a Colour Package vignette and you make use of a pal_brewer function. When I run the code, I get an error: could not find function "pal_brewer". I can't find the function anywhere in the palettes code base nor in any other R package. What am I missing?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.