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.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for molib-0.3.1.tar.gz
Algorithm Hash digest
SHA256 320d5906c803bb3790e56dcfbed6daf41c82d9df4344041a4bdfa5dea0af993e
MD5 43a100fd8783b44fa27702f36f19b471
BLAKE2b-256 87141bd884d6a958f6ab4862676f87c1bd7e67622a30de3da4b9c716205dc982

See more details on using hashes here.

File details

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

File metadata

  • Download URL: molib-0.3.1-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.7.2 Windows/10

File hashes

Hashes for molib-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c393d029dbe484e67ba6fc3eda9ef6035cbc5dd32d908870b6e23104f1d838c1
MD5 c5c13387e5d9561b4243473ec951a66c
BLAKE2b-256 80befc4aed4e69ad253b33d3e3eddf0a1d1fa246108ec3789a5a6624f6794c77

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