Package: outset
add zoom indicators, insets, and magnified panels to matplotlib/seaborn visualizations with ease!Free software: MIT licenseDocumentation:https://mmore500.com/outsetRepository:https://github.com/mmore500/outsetFeaturescompose axes grids to juxtapose a complete plot with data subsets or magnified subregionsrender grid axes as overlaid insetsdraw elegant zoom indicators with publication-ready default stylingenjoy a familiar, data-oriented interface — with full feature sets inherited directly from seabornabstract away handling of padding and aspect ratiosfine-tune appearance and layout with extensive styling options and bundled numbering/symbol libraryuse hooks to inject custom functionality, like numbering/symbols and layout tweaksInstallpython3-mpip install outsetGalleryFind example code and visualizationshere.Basic UsageUseoutset.OutsetGridto compose source plot with zoom panels on an axes grid.
Zoom sections can bea)designated manually orb)inferred to bound data subsets.
To overlay zoom panels onto source plot,c)calloutset.inset_outsets.a) CreateOutsetGrid, Explicit Zoom Areasfrommatplotlibimportpyplotaspltimportnumpyasnpimportoutsetasotstimportseabornassns# 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# 3 axes grid: source plot and two zoom framesgrid=otst.OutsetGrid([(-10,8,-8,12),(-5,5,-1,3)])# frame coordsgrid.broadcast(plt.plot,# run plotter over all axesnp.sin(i*a)*np.cos(i*b)*20,np.sin(i*c)*np.cos(i*d)*20,# line coordsc="k",zorder=-1)# kwargs forwarded to plt.plotgrid.marqueeplot()# set axlims and render marquee annotationsb) CreateOutsetGrid, Inferred Zoom Areasgrid=otst.OutsetGrid(data=sns.load_dataset("iris").dropna(),# facet over axes gridx="petal_width",y="petal_length",col="species",# create zoom panel for each specieshue="species",# color marquee annotations by speciesaspect=0.6,height=3)# adjust axes grid geometrygrid.map_dataframe(sns.scatterplot,# map plotter over faceted datax="petal_width",y="petal_length",legend=False,zorder=0)grid.marqueeplot()# set axlims and render marquee annotationsgrid.add_legend()# add figure-level legendc) Overlay Zoom Panels as Insetsgrid=otst.OutsetGrid(data=sns.load_dataset("iris").dropna(),# facet over axes gridx="petal_width",y="petal_length",col="species",# put each species in its own outsethue="species",# make different color marqueesaspect=1.5,height=4)# adjust axes grid geometrygrid.map_dataframe(sns.scatterplot,# map plotter over faceted datax="petal_width",y="petal_length",legend=False,zorder=0)grid.add_legend()# add figure-level legendotst.inset_outsets(grid,insets="NW")# inset outsets in upper-left cornergrid.marqueeplot()# set axlims and render marquee annotationsSee thequickstart guidefor more detailed usage information.API Overviewoutset.OutsetGrid: compose a source plot and zoom regions over it (e.g., “outsets”) on a multiplot latticedesignate zoom regions directly, or as regions containing data subsetsobject-oriented, “tidy data” interface a laseaborn.FacetGridoutset.inset_outsets: rearrange anOutsetGridto place outset zoom regions as insets over the original source axesoutset.marqueeplot: axis-level “tidy data” interface to draw marquees framing specified subsets of dataoutset.draw_marquee: low-level interface to draw individual marquee annotationsRead the full API documentationhere.Available Styling ExtensionsCallout mark glyphs:customize marquee identifiers; pass asmark_glyphkwargoutset.mark.MarkAlphabeticalBadges|outset.mark.MarkArrow|outset.mark.MarkInlaidAsterisk|outset.mark.MarkMagnifyingGlass|outset.mark.MarkRomanBadgesThese mark glyphs can also be used directly, independently of the rest of the library!Callout tweaks:customize how marquee callouts are shaped and positioned; pass asleader_tweakkwargoutset.mark.TweakReflect: flip callouts left-right/up-downoutset.mark.TweakSpreadArea: spread callout glyphs apart to resolve overlapsCitationIf outset is used in scientific publication, please cite it asMatthew Andres Moreno. (2023). mmore500/outset. Zenodo.https://doi.org/10.5281/zenodo.10426106@software{moreno2023outset,author={Matthew Andres Moreno},title={mmore500/outset},month=dec,year=2023,publisher={Zenodo},doi={10.5281/zenodo.10426106},url={https://doi.org/10.5281/zenodo.10426106}}Consider also citingmatplotlibandseaborn.
And don’t forget to leave astar on GitHub!ContributingThis project welcomes contributions and suggestions.
Documentation includesdetailed information to get you started.