Skip to main content

Correction of usefull plotting setup for matplotlib

Project description

Pymyplot

A collection of useful presets for the visualization of scientific data. It is intended for personal usage but feel free to take a look at it. Also, the intention of this package is to use convention of tailwincss.

As I noticed, publishing this package to pypi.org appears to be overkill. Nevertheless, I have decided to do so in order to have better access to the library for my own personal use.

Requirements

  • python >= 3.9
  • matplotlib >= 3.6.0

Installation

You can use either poetry or pip.

pip install pymyplot
# or
poetry add pymyplot

Usage

Basic

In the module, myplt overwrites matplotlib.pyplot. This is intended to apply custom matplotlib.pyplot.rcparams for a specific plot preset when it is imported. (e.g. pymyplot.aip)

>>> from pymyplot import myplt as plt  # myplt overwrites matplotlib.pyplot
>>> from pymyplot.basic import Line, Font, Marker
# Basic presets come with
# Line: default_linewidth = 1.0
# Font: default_font_size = 16.0, default_family = "sans-serif", default_font = "Helvetica"
# Marker: default_size = 16.0
>>> fig, ax = plt.subplots(...)
>>> ax.text(..., fontsize=Font.size("sm"))
>>> ax.plot(..., linewidth=Line.width("w-1.5"), marker=Marker.style("solid"))
>>> ax.scatter(..., s=Marker.size("sm"))

pymyplot also uses tailwindcss color convention.

>>> from pymyplot import get_color
>>> get_color("red-400")
"#f87171"

Each Font, Line, and Marker class is interfacing get_color method. Therefore, you can also use:

>>> Font.color("red-400")
"#f87171"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymyplot-0.2.5.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

pymyplot-0.2.5-py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page