GithubHelp home page GithubHelp logo

onc / bluenoiseplots Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 720 KB

Python implementation of Blue Noise Plots, a novel replacement for jitter plots, published at Eurographics 2021.

Home Page: https://www.uni-ulm.de/in/mi/mi-forschung/viscom/publikationen?category=publication&publication_id=195

License: MIT License

Python 100.00%
infovis stripplots jitterplot

bluenoiseplots's Introduction

Blue Noise Plots

Python implementation of Blue Noise Plots, a novel replacement for jitter plots, published at Eurographics 2021.

C. van Onzenoodt, G. Singh, T. Ropinski, and T. Ritschel

Teaser

Paper Pre-Print

Project Page

Prerequisites

This implementation uses tensorflow to enable hardware acceleration on supported platforms (Linux and Windows). Therefore, Blue Noise Plots are currently limited by prerequisites of tensorflow:

  • Python 3.5โ€“3.8
  • Ubuntu 16.04 or later
  • Windows 7 or later
  • macOS 10.12.6 (Sierra) or later (no GPU support)

Install dependencies

cd BlueNoisePlots
pip install -r requirements.txt

Usage

import pandas as pd
from blue_noise_plot import blue_noise

# Load data
mpg_filename = 'csv_data/auto-mpg.data'
column_names = ['mpg', 'cylinders', 'displacement', 'horsepower', 'weight',
                'acceleration', 'year', 'origin', 'name']
mpg = pd.read_csv(mpg_filename, delim_whitespace=True, names=column_names)
subset = mpg[mpg['cylinders'].isin([4, 6, 8])]


# Blue noise plot of `subset`, using our automatic width computation
points = blue_noise(x='mpg', data=subset, orient='h')
print('Num Classes: ', len(points))   # Num Classes:  1
print('Num Points: ', len(points[0])) # Num Points:  391

points = blue_noise(x='mpg', hue='cylinders', data=subset, orient='h')
print('Num Classes: ', len(points))   # Num Classes:  3
print('Num Points: ', len(points[0])) # Num Points:  204
print('Num Points: ', len(points[1])) # Num Points:  103
print('Num Points: ', len(points[2])) # Num Points:  84

points = blue_noise(x='mpg', hue='cylinders', data=subset, orient='h')

# Blue noise plot of `subset`, using predefined width.
points = blue_noise(x='mpg', hue='cylinders', data=subset, orient='h', plot_width=0.3)

# Render png of the distribution
blue_noise(x='mpg', hue='cylinders', data=subset, orient='h', size=20, 
           filename='mpg-blue_noise_plot.png')

Advanced Usage

# Centralized Blue Noise Plot (see Examples below)
blue_noise(x='mpg', hue='cylinders', data=subset, centralized=True,
           orient='h', size=20, filename='mpg-blue_noise_plot.png')
           
# Dodged Blue Noise Plot (see Examples below)
blue_noise(x='mpg', hue='cylinders', data=subset, dodge=True,
           orient='h', size=20, filename='mpg-blue_noise_plot.png')

Examples

Blue Noise Plot examples

To generate the examples, run the following:

cd examples
pip install -r requirements.txt
./example_plots.py

bluenoiseplots's People

Contributors

dependabot[bot] avatar onc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.