A set of helper functions for quickly making matplotlib plots using latex fonts and with a high number of built-in options.
Project description
chroptiks
Description
chroptiks is a Python package that offers advanced plotting utilities, making it easier to create complex and informative visualizations. It extends the functionality of libraries like matplotlib and scipy, providing a user-friendly interface for a variety of plotting needs.
Requirements
Python libraries: matplotlib, numpy, scipy
Other: LaTeX. If you don't want to use LaTeX in the plotting, edit the plotting_utils.py
file and either comment out the line : plt.rc('text', usetex=True)
, or set the usetex
keyword to be False
before installing the package.
Installation
To install chroptiks from source, run:
git clone https://github.com/cagostino/chroptiks.git
cd chroptiks
python setup.py install
Otherwise simply install from pip:
pip install chroptiks
Usage
Here's how you can use your_package_name in your projects:
from chroptiks.plotting_utils import hist2d, hist1d, scatter, plot3d, plotbar
Features
---2D Histograms (hist2d): Easily create 2D histograms for data analysis.
---1D Histograms (hist1d): Simplify the process of creating and customizing 1D histograms.
---Scatter Plots (scatter): Enhanced functionality for scatter plot creation.
---3D Plots (plot3d): Intuitive tools for 3D data visualization.
---Bar Charts (plotbar): Quick and customizable bar chart creation.
Example usage
hist2d, hist1d, scatter, plot3d, plotbar are now ready to be used as per their defined functionalities and plots are generated through each of their plot methods. For example:
import numpy as np
from chroptiks.plotting_utils import hist2d
x = np.linspace(-1,1, 100000)+np.random.normal(0,.1, size=100000)
y = x**(3)+np.random.normal(0, 0.3, size=100000)
z = np.random.normal(size=100000)
hist2d.plot(x,y,nx=200,ny=200)
hist2d.plot(x,y,nx=40, ny=40, ccode = z, ccodename='Z', xlabel='X', ylabel='Y')
hist2d.plot(x,y,nx=200,ny=200,bin_y=True, size_y_bin=0.1, xlabel='X', ylabel='Y', percentiles=False)
from chroptiks.plotting_utils import hist1d
hist1d.plot(z, range=(-2,2), bins=100, xlabel='Z', ylabel='Counts')
hist1d.plot(z, range=(-2,2), bins=100, xlabel='Z', ylabel='Counts', normed=True)
hist1d.plot(z, range=(-4,4), bins=100, xlabel='Z', ylabel='Cumulative Count', cumulative=True)
from chroptiks.plotting_utils import scat
#scat
scat.plot(x,z)
#scat with color-code
scat.plot(x,y, ccode=z, color=None, edgecolor=None, vmin=-0.5, vmax=0.5)
#note if you use ccode to color the points, you must set color to None, and I would advise you to set edgecolor to None as well or else each will have outlines.
#scat with y-binning
scat.plot(x, y, bin_y=True, size_y_bin=0.1, percentiles=True, xlabel='X', ylabel='Z', aspect='auto')
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
Built Distribution
Hashes for chroptiks-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 800f14d9c144ce7428a7dbabfc3d15d528a44d00e3d8e734d4b714a284cc1b3e |
|
MD5 | 177c1d5862991e1affd60fc525837860 |
|
BLAKE2b-256 | 33732c6a83293e4b889ff849af19f791092bc09c7ae1709d72667e7a511eed3d |