Easily indicate zoom plot areas in Matplotlib
Project description
Easily indicate zoom plot areas in Matplotlib
Free software: MIT license
Documentation: https://mmore500.com/outset
Repository: https://github.com/mmore500/outset
Features
Gallery
Check out the project’s gallery page for example heatmap, imshow, kde lineplot, regplot, scatterplot, patch, and more visualizations created with outset.
Basic Usage
Refer to the quickstart guide for more detailed usage information.
Select Outset Regions Manually
from matplotlib import pyplot as plt
import numpy as np
import outset as otst
import seaborn as sns
grid1 = otst.OutsetGrid(
[(-10, 8, -8, 12), (-5, 5, -1, 3)], # frame positions (x0, y0, x1, y1
)
# broadcast plot content to all axes
# adapted from https://matplotlib.org/stable/gallery/
i, a, b, c, d = np.arange(0.0, 2*np.pi, 0.01), 1, 7, 3, 11
grid1.broadcast(
plt.plot,
np.sin(i*a)*np.cos(i*b) * 20, # x values
np.sin(i*c)*np.cos(i*d) * 20, # y values
c="k",
zorder=-1,
)
grid1.marqueeplot() # render marquee annotations, adjust axlims
plt.savefig("usage1.png")
Outset Regions Containing Data Subsets
grid2 = otst.OutsetGrid( # setup axes grid
aspect=0.6,
data=sns.load_dataset("iris").dropna(),
height=3,
x="petal_width",
y="petal_length",
col="species", # put each species in its own outset
hue="species", # make different color marquees
)
# map scatterplot over all axes
grid2.map_dataframe(
sns.scatterplot,
x="petal_width",
y="petal_length",
legend=False,
zorder=0,
)
grid2.marqueeplot() # dispatch marquee render, adjust axlims
grid2.add_legend() # add figure-level legend
plt.savefig("usage2.png")
Convert Outset Plots to Insets
grid3 = otst.OutsetGrid( # setup axes grid
aspect=1.5,
data=sns.load_dataset("iris").dropna(),
height=4,
x="petal_width",
y="petal_length",
col="species", # put each species in its own outset
hue="species", # make different color marquees
)
# map scatterplot over all axes
grid3.map_dataframe(
sns.scatterplot,
x="petal_width",
y="petal_length",
legend=False,
zorder=0,
)
grid3.add_legend() # add figure-level legend
otst.inset_outsets(grid3, insets="NW") # inset outset plots over source axes
grid3.marqueeplot() # dispatch marquee render, adjust axlims
plt.savefig("usage3.png")
Install
python3 -m pip install outset
API Overview
outset.OutsetGrid: compose a source plot and zoom regions over it (e.g., “outsets”) on a multiplot lattice
designate zoom regions directly, or as regions containing data subsets
object-oriented, “tidy data” interface a la seaborn.FacetGrid
outset.inset_outsets: rearrange an``OutsetGrid`` to place outset zoom regions as insets over the original source axes
outset.marqueeplot: axis-level “tidy data” interface to draw marquees framing specified subsets of data
outset.draw_marquee: low-level interface to draw individual marquee annotations
Read the full API documentation here.
Available Styling Extensions
Callout mark glyphs: customize symbols identifying marquee annotations
Callout tweaks: customize how marquee callouts are shaped and positioned
Citation
Contributing
This project welcomes contributions and suggestions. Our documentation includes detailed information to get you started.
Project details
Release history Release notifications | RSS feed
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 outset-0.0.0rc198.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b51df0fe8a2252a325815ce7be66302827f7378c5e20e787bbe267098c294bb |
|
MD5 | 3424449f7d3e39a5ae592230cc578803 |
|
BLAKE2b-256 | 4a0e13b1d12a5ae03e3a9f78b5d126400c619bb10945fe84f953e3748ab94e01 |