Skip to main content

plotannot

PyPI Version

Introduction

plotannot is a a python package to automatically highlight and adjust overlapping ticklabels in matplotlib/seaborn plots.

This package started as the need of ComplexHeatmap (R package) style annotations for Python plots but is also created with great inspiration and appreciation of the statannot package (webermarcolivier/statannot - now maintained at trevismd/statannotations), as well as the adjustText package (Phlya/adjustText).

Features

  • Add annotation lines for certain row/column labels
  • Shift labels to not overlap
  • Add additional highlights such as color, fontsize, etc. to certain row/column labels

Getting started

Install from PyPI:

pip install plotannot

Or directly from github:

pip install git+git://github.com/msbentsen/plotannot

Requirements for package:

  • Python >= 3.6
  • matplotlib
  • numpy

Simple example

#Plot heatmap
ax = sns.heatmap(table, xticklabels=True, yticklabels=False)

#Rotate all labels
plotannot.format_ticklabels(ax, axis="xaxis", rotation=45)

#Annotate labels
to_label = range(20,35)
plotannot.annotate_ticks(ax, axis="xaxis", labels=to_label) 

#Color individual labels
plotannot.format_ticklabels(ax, axis="xaxis", labels=[25], color="red")

Additional examples are found in the examples notebook.

Documentation and help

Documentation of the main functions are found at:

Issues and PRs are very welcome - please use the repository issues to raise an issue/contribute.

Metadata

Release files for plotannot 0.1.0

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

Source distribution (sdist)

Source distribution for plotannot 0.1.0
File Size Uploaded
plotannot-0.1.0.tar.gz 704.4 kB Details

Release files / plotannot-0.1.0.tar.gz

Download URL plotannot-0.1.0.tar.gz
Size 704.4 kB
Tags Source
SHA-256 checksum
How to use checksums
47a64627cfcecb00d3c510b6664ffc8815ed6d846ebd7efd1f7854d95a1049c1
BLAKE2b-256 checksum
How to use checksums
5ea7ce577cf8971211a28d62971915b3ab076937907541c07f21d8efe6e5d8d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.8

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

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