Skip to main content

Some helpful tools I use in research and fun. Primarily targeted to data visualization and pretty colours.

Project description

hamHelper PyPI version Test Workflow Coverage

Description

This repository contains the HamHelper package written in Python3 for scientific plotting and analysis tools geared towards speeding up common workflows in my experience. This is mainly a wrapper of matplotlib with some script and numpy for common physics use cases.

Usage

Installing

In order to use this package you will need to have installed:

  • Python3.XX,
  • matplotlib,
  • numpy.

Install as you normally would with pip: pip install hamhelper

Submodules

HamHelper.    # package root
|- plotting   # plotting helpers
|- colours    # colourmap definitions, helper functions, and custom colour class HamColour 

Purpose

This package contains a set of helper functions and methods I use. Primarily geared towards physics, experimental analysis, and data visualization. The goal is to simplify common procedures around generating pretty plots with minimal chart-junk as well as getting the values that matter (ie. curve fit routine that also computes standard error and chi squared). In general, there are three parts:

plotting

hamhelper.plotting.despine()
Simple matplotlib wrapper to despine. Offers offset axis as well as trimmed axis like in Seaborn.

despine(axis = None, trim = False, drop = 0, noLine = False, bottom = True, left = True, top = False, right = False):  

axis: None or mpl.axes object (opt.)
The axes object to act on, default plt.gca().
trim: bool (opt.)
If true trims axes to the limiting ticks, default False.
drop: float (opt.)
Distance to space spine from axes in pixels. Default 0.
noLine: bool (opt.)
If true removes the spine but keeps the axis ticks, default False.
bottom, left, top, right: bool (opt.)
Enable or disable the corresponding axes spine, default keeps bottom and left, removes top and right.

hamhelper.plotting.errorbands()
Wrapper of matplotlib.pyplot.errorbar producing continuous bands instead of stems. You can additionally enable the caps still.

errorbands(x, y, yerr, capsize = 0, ax = None, color = None, *args, **kwargs):  

x: np.array like
The x dimension of pairwise data.
y: np.array like
The y dimension of pairwise data.
yerr: np.array like
The error in the y dimension of pairwise data.
capsize: float (opt.)
The width of caps to be added above each data point at the same location as the error band.
ax: None or plt.axes object (opt.)
Can specify to plot on another axis, defaults to plt.gca()
color: tuple or string (opt.)
Facecolor of the error band. If tuple provided, expects a tuple of RGB or RGBA values. If string provided expects a hex '#RRGGBB' or matplotlib named color. Defaults None for no fill color.
*args & **kwargs: (opt.)
Passed to plt.ax.fill_between().


colours

A suite of colour sets and colour maps I use with a custom HamColor class to easily import and play with the colours. Just stuff I like to use!

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

hamhelper-1.12.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hamhelper-1.12-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file hamhelper-1.12.tar.gz.

File metadata

  • Download URL: hamhelper-1.12.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for hamhelper-1.12.tar.gz
Algorithm Hash digest
SHA256 38841d6aa330b4b43efb5eecfe73ca539a7473a024cb58056da234a490a3148b
MD5 1dc03bcf62a93acb4d53b67b509373ad
BLAKE2b-256 f9bda61a55b6ac0d338f7ab0bf6d0c86ea30ebeb7476391922d50b09857e2bf4

See more details on using hashes here.

File details

Details for the file hamhelper-1.12-py3-none-any.whl.

File metadata

  • Download URL: hamhelper-1.12-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for hamhelper-1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 59f9ea8ac54a03167f161be6507d397517971b92fd4e2c7bdeeb151d07af2606
MD5 e3157c3d8cdd8fe8b1fe1358dae27db1
BLAKE2b-256 e5de65ecbf7848e52d2c1533e6d0841f00f6b2730ed2846f4931752588c66304

See more details on using hashes here.

Supported by

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