Skip to main content

No project description provided

Project description

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.

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

plotannot-0.1.0.tar.gz (704.4 kB view hashes)

Uploaded Source

Supported by

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