Giter VIP home page Giter VIP logo

nature-grade-visualization-playground's Introduction

Nature-Grade Visualization

Introduction

Liz.inno.3

Data visualization is an important aspect the work we do at BioLizard. To ensure that we follow best practices as much as possible, we initiated the "nature-grade visualization" innovation project. One of the goals of this project to develop R and Python packages to add a consistent visual style to our figures. Some prime candidates are ggplot2, matplotlib, and seaborn). This repository acts as a "pre-production" playground to work on this development.

For a list of guidelines and best practices that everyone within BioLizard should adhere to, please refer to this Notion document. Turn to this one for a more in depth discussion about some of the data visualization do’s and don’ts.

Packages in This Repository

This repository contains two key packages:

  1. BioLizardStyleR - An R package designed for ggplot2.
  2. BioLizardStylePython - A Python package designed for matplotlib, also compatible with seaborn.

Developed by Robbe Neirynck during an internship at BioLizard

Installation and Usage

For installation details, usage examples, and example workflows, please refer to the "In Action" files specific to each package. Most information below this point is general, but the "In Action" files contain specialized guidance. At the very bottom of this README you can also find the needed installation info.

Both packages have three main components:

1. Styling Function: lizard_style()

This function applies a BioLizard aesthetic to your ggplot, matplotlib, or seaborn plots. The aim is to ensure that plots maintain a uniform look, irrespective of whether they were made in R or Python.

2. BioLizard Color Palettes

These are qualitative, sequential, and divergent color maps that can be applied to your plots. The palettes are designed using BioLizard's house colors, keeping perceptual uniformity and color-blind friendliness in mind. For more information, consult the help documentation specific to each function.

3. Finalizing and Exporting Plots: finalise_lizardplot()

This function adds a BioLizard footer beneath your graph and exports it to a specified format such as PNG or PDF. The footer includes the BioLizard logo at the bottom right corner and leaves room for source text.

Required Fonts!

Before using these packages, install the NunitoSans fonts from the fontstoinstall folder. NunitoSans is an open-license google-font that closely resembles BioLizard's house font, Avenir.

Contributing and Feedback

Contributions and feedback are very welcome and much appreciated.

To report issues or provide feedback, you can:

  • Open an issue on GitHub

  • Contact us via the following channels:

    • Project Supervisor: [email protected]
    • Slack: there is a (private) #nature-grade-visualisations channel. Let Alexander know if you'd like to be added!

Installation BioLizardStyleR

Note: Only possible like this if the repo is public already

if (!requireNamespace("devtools", quietly = TRUE)) {
  install.packages("devtools")
}

devtools::install_github("lizard-bio/nature-grade-visualization-playground", subdir="BioLizardStyleR")

library(BioLizardStyleR)

install_biolizard_fonts()

Installation BioLizardStylePython

1. Extra requirements

BioLizardStylePython relies on the colorspace package, which is not available on the Python Package Index (PyPI). However, it is hosted on GitHub and needs to be installed directly from there. To install the colorspace package, please run the following command in your terminal:

pip install git+https://github.com/retostauffer/python-colorspace.git

Once you've successfully installed colorspace, you can proceed with the installation and usage of BioLizardStylePython.

2. Package Installation

The BioLizardStylePython package is available on PyPI and can be easily installed using:

pip install BioLizardStylePython
Common Issue

If matplotlib is previously installed, you might need to delete the existing local font cache of matplotlib for it to recognize the Nunito Sans font.

You can find the dir of the cache by running import matplotlib as mpl; print(mpl.get_cachedir()).

nature-grade-visualization-playground's People

Contributors

robbeneirynck avatar akoch8 avatar

Watchers

Erik Vandeputte avatar  avatar  avatar

nature-grade-visualization-playground's Issues

Error when applying lizard_style

After installing the BioLizardStyleR package, I tried running the following example:

p <- ggplot(mtcars, aes(mpg, disp)) + geom_point()
p + lizard_style()

But I received the following error:

Error in UseMethod("depth") : 
  no applicable method for 'depth' applied to an object of class "NULL"

System: macOS Big Sur (11.2.3)
R version: 4.1.2 (2021-11-01) -- "Bird Hippie"
vctrs: 0.6.2
ggplot2: 3.4.3

Update type

The BioLizard marketing team has updated its type from Avenir to Lato. The data visualisation packages should reflect this change.

Tasks

Update readme

Some small remarks for the readme.

The readme still mentions the old house font:

Before using these packages, install the NunitoSans fonts from the fontstoinstall folder. NunitoSans is an open-license google-font that closely resembles BioLizard's house font, Avenir.

The vignette also mentions you can install the Lato font from the git repository but in FontsToInstall only nunitosans is present.

It might be best to remove
install_biolizard_fonts() from the Installation BioLizardStyleR section. Running this function is not always necessary. The vignette explains this in more detail.

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.