Skip to main content

Manny's code snippets

Project description

molib

This package contains functions that I keep re-using in different packages, so I decided to publish them, in case it helps other too.

Installation

To install molib, use pip (or similar):

pip install molib

Documentation

Figures

Add letter labels to all subplots in a figure.

label_subplots(fig, size=14)
  • Adjusts figure padding and left margin to make labels fit.
  • Uses add_subfig_label and gen_sub_label.

Add a subplot label to an axis.

add_subfig_label(ax, label, size=14)

Generate the next figure label.

gen_sub_label(lower=False, paren=False)
  • Produces the next letter in the alphabet as a subfig label.
  • Label can be uppercase or lowercase, with optional parentheses.

Save plots in a directory

save_plot(output_filename, proj_dir=Path.cwd(), subdir=None, fig=None)
  • Function for saving plots (active plot or given figure) and printing a console message.
  • Saves as a 300dpi png file.
  • Makes plots directory if it does not exist.
  • Directory name is customizable.

Colors

Rescale RGB to values between 0 and 1

rescale_colors(color_list)

Tableau 10 Colors

tableau10(index)

Tableau 20 Colors

tableau20(index)

Tableau Color Blind 10

tableau10blind(index)

Logging

Custom console logger

import logging
console_logger(logging.DEBUG)

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

molib-0.3.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

molib-0.3.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file molib-0.3.0.tar.gz.

File metadata

  • Download URL: molib-0.3.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.11 CPython/3.6.8 Windows/10

File hashes

Hashes for molib-0.3.0.tar.gz
Algorithm Hash digest
SHA256 db171c71c815733fb21a7f71781d4394fc384e798a342974b8f770ad0af16766
MD5 227e39dbeb34dc2565d0a7d8adc68d39
BLAKE2b-256 243595c328600241a5881162d65ba9d285c75da3cbcaa99201c8f53b15ad6acf

See more details on using hashes here.

File details

Details for the file molib-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: molib-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.11 CPython/3.6.8 Windows/10

File hashes

Hashes for molib-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d9b376cee9bdebe3a1b18970180eda31a1827813bd714a43b2f88080bad4b4a
MD5 f2c8e6442ffdcedc48480b2d7b57b86c
BLAKE2b-256 c3565bec3c96e9e9c37569c1bfd664c8827bd7432d2d74be15d08d8a9240deab

See more details on using hashes here.

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