Skip to main content

Custom-Plotting

PyPI version Downloads

Custom-plotting is a python package written with the aim of producing scientific publication quality figures as quickly as possible with as little code as possible (checkout examples).

So instead of typing 8 lines of code in matplotlib everytime:

import matplotlib.pyplot as plt
from matplotlib_scalebar.scalebar import ScaleBar

"""Plot image"""
plt.figure()
plt.imshow(img_data)
cb = plt.colorbar()
cb.set_label("Height (nm)", fontsize=20, fontweight='bold')
plt.gca().axes.get_yaxis().set_visible(False)
plt.gca().axes.get_xaxis().set_visible(False)
"""Add scalebar"""
scalebar = ScaleBar(dx=0.5, units='nm') # 1 pixel = 0.5 nm
plt.gca().add_artist(scalebar)

You only need 1 line of code to get the same plot:

from customplotting.mscope import plot_confocal

"""Plot image with scalebar"""
plot_confocal(img_data, stepsize=0.5, units='nm', cbar_label="Height (nm)")

It saves you from a lot of unnecessary typing (if you often plot data)

The functions wrap around matplotlib library for plotting with the customizable options. For instance, you can directly add a scalebar to your image without additional code. The figures can customized (colorbar, axis, linewidth, labels, etc) using the same key word arguments as in matplotlib. See function docstrings for more information about customization.

Install

pip install customplotting

Example Usage

"""Make a publishable image with scalebar"""
from customplotting.mscope import plot_confocal
plot_confocal(img_data, stepsize=0.5, units='nm', cbar_label="Height (nm)")

Sample Image

"""Make a publishable X-Y plot"""
from customplotting.general import plot_xy
plot_xy([1,2,3], [4,5,6], xlabel="Random X", ylabel="Random Y")

Check out the jupyter notebook for more examples

Why use?

Matplotlib is an AMAZING package but if you are like me and are tired of typing 5-7 lines of code everytime you want a good publishable quality figure, then customplotting is the answer.

Customplotting basically wraps the matplotlib functions to allow you to quickly plot commonly used plots like x-y, images with scalebars, etc with only one line of code.

What's New?

  • Plot X-Y with custom settings (from v0.1.4)
  • Scalebar can be added to the plot using a new dependency matplotlib_scalebar (from v0.1.3)
  • For widefield (pixera) plots, scale can automatically be selected by choosing the objective used
  • Colorbar can be customized with labels (and also removed if needed)
  • X-axis and Y-axis ticks can be added/removed now

Contribute

Contributions are always welcome! See CONTRIBUTING.md

Issues

Open an issue if you come across any!

License

MIT License

Dependencies

  • matplotlib
  • matplotlib_scalar
  • numpy

Metadata

Release files for customplotting 0.1.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for customplotting 0.1.4.2
File Size Uploaded Provenance
customplotting-0.1.4.2.tar.gz 5.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for customplotting 0.1.4.2
File Interpreter ABI Platform
customplotting-0.1.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / customplotting-0.1.4.2.tar.gz

Download URL customplotting-0.1.4.2.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2cd8b4ef89f98602bf7bef46e7a332f8221f6eb582d520825cdff289c4bcdd52
BLAKE2b-256 checksum
How to use checksums
0b6ac07eee29c38083cb942d422b83660674b8b744a0817e3cd7188303474d21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10

Release files / customplotting-0.1.4.2-py3-none-any.whl

Download URL customplotting-0.1.4.2-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e352d64bfdc45b7366cca0abc82a00ee9f872fb1fd0db56d1092e771d26708a1
BLAKE2b-256 checksum
How to use checksums
2f228ab961f500ea238333e35e6957c1a553ef8cfedda3c31271a8d8a298f65a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10

Security for customplotting 0.1.4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page