Giter VIP home page Giter VIP logo

niceplots's Introduction

NicePlots

A collection of nice styles and helper functions for matplotlib

Build Status Documentation Status PyPI PyPI - Downloads Code style: black

How do I install?

NicePlots can be pip installed directly from PyPI

pip install niceplots

If you want to make changes

  • Clone this repository, then enter the folder in the command line terminal.
  • Enter pip install -e . within the niceplots folder.

Font installation (optional)

NicePlots styles use fonts that do not ship with most operating systems, so you'll need to install them separately. If they are not installed, matplotlib will revert back to its default sans-serif font, DejaVu Sans.

The font used by each style is as follows:

  • doumont-light (default niceplots): CMU Bright
  • doumont-dark: CMU Bright
  • james-dark: Prompt
  • james-light: Prompt

Install the fonts on your system and then delete Matplotlib's font cache, which is located in ~/.cache/matplotlib by default on most operating systems. Matplotlib will rebuild the font cache next time it is run and (hopefully) find the new fonts.

CMU Bright (doumont-light and doumont-dark)

The computer modern bright font can be downloaded from this link. Alternatively, on Ubuntu, the font can be installed with the following commands:

sudo apt-get update
sudo apt-get install fonts-cmu

Arch linux users can get the font by installing the otf-cm-unicode package from AUR.

Prompt (james-dark and james-light)

The Prompt font can be download from Google Fonts.

How do I get set up?

  • import matplotlib.pyplot as plt and import niceplots at the top of a file where you would like to use any function defined in this package.
  • Use plt.style.use(niceplots.get_style()) to set some defaults for nice-looking plots. You can also try passing different styles to get_style(), such as NicePlots' "james-dark" or any of matplotlib's styles (see the function's documentation for a full list of available NicePlots styles).
  • Take advantage of NicePlots' helper functions, including (but not limited to) adjust_spines, horiz_bar, and plot_nested_pie, which are all documented in the examples gallery.
  • Admire your beautiful data.

Do you have docs?

Sort of, you can find our examples gallery and API documentation here

Help, my old NicePlots code doesn't work anymore!

We made a couple of changes to the API in version 2.0.0, most of them can be fixed with a simple find and replace. Check the release notes for more details.

Contribution guidelines

  • Make any changes you see fit. Please fork your own version and submit a pull request.

Who do I talk to?

niceplots's People

Contributors

a-cgray avatar eirikurj avatar ewu63 avatar eytanadler avatar hajdik avatar jennank avatar johnjasa avatar marcomangano avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

niceplots's Issues

More flexible data input

Description of feature

Currently, I believe all the data inputted must share the same x value, which is rather limiting. I would like to be able to plot arbitrary x-y pairs (perhaps with an identifier that can be used as a legend item) on subplots.

For example, the following data structure might be able to make two subplots, the top one containing two lines and the bottom one a single line. These subplots share the same x axis/label, but have separate y-axis labels ("Lift" and "Drag"). The user can optionally add legends to the line (e.g. "Composite" or "Metallic").

data = OrderedDict(
    {
        "Lift": [
            {"Time (s)": np.ones(5), "Composite": np.ones(5)},
            {"Time (s)": np.ones(3), "Metallic": np.ones(3)},
        ],
        "Drag": [
            {"Time (s)": np.ones(2), "Composite": np.ones(2)},
        ],
    }
)

Does this make sense? Are there better data formats available? We also want to take care of the simple case where all the lines share the same x values, but maybe it's not too bad to ask the user to provide the same array a bunch of times?

Improve documentation

Description of feature

Potential solution

  • fix some docstrings (e.g. math rendering etc.) and sphinx linking to other functions
  • add a bit more text to explain the examples, or make them more uniform
  • move some of the installation notes from the README to the RST files

Orange color looks red

In using this package, I found the color labeled orange #E64616 in the niceColors dictionary is not truly orange. It is too similar to the red #E21A1A, making it difficult to distinguish between the two.

To avoid confusion, the color should either be relabeled as RedOrange or changed to a color such as #ff7f0e.

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.