Giter VIP home page Giter VIP logo

jtheme's Introduction

jtheme : Enhanced ggplot2 theme and functions

Welcome to jtheme, a collection of enhanced functions and a custom theme for R package ggplot2, adapted for scientific content such as papers, presentations and more.

Installation

jtheme use the Source Sans Pro, which is an open source font from Google. It needs to be installed on your system and in R. It is located in the fonts/ folder of the package. You will need the packages extrafont and Rttf2pt1 in order to get the Source Sans Pro into R properly before you can use jtheme.

  1. Install ggplot2 and extrafont packages :
install.packages("ggplot2")
install.packages("extrafont")
  1. Install Rttf2 using the remotes package :
install.packages("remotes")
library(remotes)
remotes::install_version("Rttf2pt1", version = "1.3.8")
  1. Import the Source Sans Pro font into R :
extrafont::font_import(path = "_fonts/")
  1. You can now install jtheme directly from GitHub :
install.packages(
    pkgs  = "https://github.com/jeremieboudreault/jtheme/raw/main/_bin/jtheme_0.0.2.tar.gz", 
    repos = NULL
)
  1. You can start using jtheme by simply adding it to your ggplot2 plots :
library(jtheme)
ggplot() + ... + jtheme()

Examples

Note : All examples are from fake data.

1. Histogram of temperature data

+ jtheme(
    expand_xy      = "x_only",   # Remove expanding of y-axis
    legend_pos     = "topright", # Legend at the top-right
    show_leg_title = FALSE       # Hide legend title
)

2. Times series of GHG evolution

+ jtheme(
    expand_xy      = FALSE,      # No expansion of x and y axes
    legend_pos     = "topleft",  # Legend at top-left
    show_leg_title = FALSE       # No legend title
)

3. Times series of air pollution

+ jtheme(
    expand_xy        = FALSE,      # No expansion of x and y axes
    legend_pos       = "topleft",  # Legend at top-left
    show_leg_title   = FALSE       # No legend title
    x_labs_to_months = TRUE        # Convert x-labels to months
)

4. Scatter plot of air pollution and temperature

+ jtheme(
    show_grid = TRUE  # Add a grid in the plot
)

5. Scatter plot of air pollution and temperature by facets

+ jtheme(
    show_grid = TRUE,  # Add a grid in the plot
    borders   = "all"  # Add complete borders
)

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.