Giter Site home page Giter Site logo

atlas-aai / ratlas Goto Github PK

View Code? Open in Web Editor NEW
28.0 3.0 8.0 18.3 MB

Custom graphics and report generation for @atlas-aai

Home Page: https://ratlas.netlify.app

R 66.04% TeX 29.86% CSS 3.33% HTML 0.17% Lua 0.59%
r rstats rmarkdown rmarkdown-template bookdown ggplot2 ggplot2-themes

ratlas's People

Contributors

jeffreychoover avatar jpedroza1228 avatar noellepablo avatar wjakethompson avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

ratlas's Issues

set theme functions

Based on my pet peeves, I've decided against changing plotting defaults automatically when the package is loaded. However, let's write a couple functions that can globally set options if someone desires (i.e., could be used in the setup chunk of an Rmd).

There should be two versions: one for theme_atlas() (#5) and one for theme_atlas_ms() (#10). These functions should:

  • set the default ggplot2 theme to the corresponding atlas theme
  • set the default color and fill scales for discreet variables to Okabe Ito
  • set the default color and fill scales for continuous variables to viridis
  • set the default font for text and label geoms to the appropriate font for the atlas theme

plotting vignette

Create a vignette showcasing how to create atlas themed ggplot2 plots. Should include how to use:

  • theme_atlas() (#5)
  • theme_atlas_ms() (#10)
  • palette OkabeIto
  • palette atlas
  • theme setting functions (#11)

Should probably also begin with a brief section directing users to general ggplot2 resources, for those who aren't as familiar with ggplot2. Some ideas, but feel free to add others you have come across:

Update deprecated `dplyr::across()` functionality

The `...` argument of `across()` is deprecated as of dplyr 1.1.0.
Supply arguments directly to `.fns` through an anonymous function instead.

  # Previously
  across(a:b, mean, na.rm = TRUE)

  # Now
  across(a:b, \(x) mean(x, na.rm = TRUE))

Release ratlas 1.0.0

Prepare for release:

  • devtools::check()
  • devtools::check_win_devel()
  • rub::check_for_cran()
  • Polish NEWS
  • Polish pkgdown reference index
  • Draft blog post

Submit to CRAN:

  • usethis::use_version("major")
  • Update cran-comments.md
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

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

Installation issue

remotes::install_github("atlas-aai/ratlas")

Error: Failed to install 'unknown package' from GitHub: HTTP error 404. No commit found for the ref master Did you spell the repo owner (atlas-aai) and repo name (ratlas) correctly? - If spelling is correct, check that you have the required permissions to access the repo.

xaringan template

For creating slide decks in Rmd.

Read about xaringan here.

Documentation (in a xaringan presentation) here.

See example custom themes already inside the xaringan package here.

report writing vignette

This vignette should demonstrate how to use ratlas to write reports.

  1. Create new project using the "new project" template
  2. Structure the project directories using the here package (see example usage here).
    • R/ - for analysis scripts
    • data-raw/ - for raw data files
    • data/ - for cleaned data, or intermediate data files
    • output/ - for final output files to be read into report, if not calculated in the report directly
  3. Setup chunk
    • loading package in reproducible way
    • setting ggplot2 themes (see #11)
  4. Create and cross reference tables
  5. Create and cross reference figure
  6. Using in line R code to dynamically populate values in the document
  7. Combining words using knitr::combine_words()
  8. Turning numbers into words using the english package

figure accessibility

from MK--

"In prepping a bunch of slide decks for presentations at conferences with stringent accessibility criteria, I ran into a case where we had to rebuild a graph originally generated in r by hand-entering the stats into excel and reproducing the graph. This was the best path toward getting the figure to meet accessibility criteria, rather than writing a long paragraph of alt text that didn’t conform to certain standard sequencing of information. This experience made me think R&P might want to consider extra commands in their scripts for some types of figures so we can get data like that in a little table that easily reads into excel. In this case it was clustered bar graphs showing percentages, if that helps the idea become more concrete. I can see how other graphs would be hard to reproduce in tabular form that excel would know what to do with.

I don’t have a particular solution or goal – just handing it off for consideration."

custom ggplot2 theme

I would like to have a custom atlas ggplot2 theme that we can add to all our graphics with something like

+ theme_atlas()

My ideal look would be similar to theme_ipsum() from hrbrthemes, so that's probably a good place to start in terms of how to create a theme. He also has examples of how to write tests for these functions, so we will want to mimic that as well. We'll want to make some modifications to this. For example, in theme_ipsum axis title are not centered by default, and have a smaller font and the axis text. It would also be good to have the legend be at the bottom of the plot by default.

In addition, I'm hoping you can google around and figure out how to set a default color palette. I ideally, we would use palette_OkabeIto from the colorblindr package for discrete scales, and viridis from viridisLite for continuous scales. I feel like I've seen somewhere how to change the default color scales, but I can't remember now.

What I'm hoping for is that this:

library(tidyverse)
library(ratlas)

ggplot(mtcars, aes(x = mpg, y = disp)) +
  geom_point(aes(color = factor(cyl))) +
  theme_atlas()

Will do the same thing as:

library(tidyverse)
library(hrbrthemes)
library(colorblindr)

ggplot(mtcars, aes(x = mpg, y = disp)) +
  geom_point(aes(color = factor(cyl))) +
  scale_color_OkabeIto() +
  theme_ipsum(axis_title_just = "c",
              axis_title_size = 12,
              axis_text_size = 10) +
  theme(legend.position = "bottom")

Created on 2019-05-15 by the reprex package (v0.2.1)

images not rendering without fig.alt

Images don't render in HTML document if alt text isn't provided in the fig.alt parameter. Images should render with fig.alt defaulting to fig.cap if alt text is not provided.

cover sheet for pdf topic guide

IDEA:

  • separate latex template for cover sheet.
  • include template .Rmd file in project for cover sheet
  • wrapper function for rmarkdown::render that renders both cover sheet and topic guide, then binds together
  • in project template Rmd, add yaml field that changes the binding of the knit button

data checks

add checks to verify arguments sent into functions

table formatting

wrap kableExtra::kbl() to apply common formatting

  • kableExtra::kable_styling()
  • standard arguments to kbl()
  • HTML formatting
  • kable_classic()

ratlas pkgdown site

Create pkgdown site for the package. See the pkgdown repo and website for how to create website.

On the reference page with all the functions, group by type (e.g., plotting, RMarkdown).

fmt_prop rendering incorrectly for html

fmt_prop is not rendering correctly for html versions of the tech manual, specifically values that become <.01, <.001, etc. It appears that the code for the less than symbol is being misinterpreted when rendering to html output.

theme_atlas_ms

This should be very similar to theme_atlas, but using the Montserrat font. See theme_ipsum_tw from hrbrthemes for an example of using a new font, and importing the font.

Should also include a function to set the default text and label fonts (see the update_geom_font_defaults() function in theme-atlas.R, which may need to be renamed).

n (%) columns

After applying fmt_table(), we need a helper function to combine two columns, n and pct, into a single column n (%) that preserves the spacing added by fmt_table()

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.