Coder Social home page Coder Social logo

rgplot's Introduction

rgplot

A custom matplotlib style to generate nice-looking matplotlib figures, with just a single line plt.style.use('rgplot').

Example

Reproduce the right-side plot below with the following few lines of Python.

import matplotlib.pyplot as plt
import numpy as np

# use custom style
plt.style.use('rgplot')

# sample data
x = np.linspace(0, 2*np.pi, 100)
y = (np.sin(x) * np.exp(-0.5 * x)).repeat(5).reshape(-1, 5) * np.linspace(0.5, 1.5, 5)

# make plot
plt.plot(x, y)
plt.xlabel("Time")
plt.ylabel("Damped sine")
plt.legend((r"$r = 0$", r"$r = 1$", r"$r = 2$", r"$r = 3$", r"$r = 4$"))
plt.show()

sampleplot_comparison-01

Installation

mkdir -p "$(python -c "import matplotlib; print(matplotlib.get_configdir())")/stylelib"
wget -P "$(python -c "import matplotlib; print(matplotlib.get_configdir())")/stylelib" https://raw.githubusercontent.com/gautierronan/rgplot/main/rgplot.mplstyle

Alternatively, you can download rgplot.mplstyle and place it in your matplotlib style folder. You can find your matplotlib folder by running matplotlib.get_configdir() in a Python environment, with matplotlib imported. By default, the matplotlib folder is ~\.matplotlib\stylelib\.

rgplot's People

Contributors

gautierronan avatar

Stargazers

Varun Seshadri avatar

Watchers

 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.