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
andgen_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 hashes)
Built Distribution
molib-0.3.1-py3-none-any.whl
(8.1 kB
view hashes)