--- id: matplotlib-scalebar version: "0.9.0" license: unclear license_treatment: permissive maintenance: dormant --- # matplotlib-scalebar — Artist for matplotlib to display a scale bar License: permissive · Maintenance: dormant · Downloads: 148.9K/mo ## What it is and what it does matplotlib-scalebar extends matplotlib with a new artist class that overlays a scale bar on plots, primarily for displaying calibrated images via imshow(). You specify the pixel size (dx) and its units, and the package automatically renders an appropriately-scaled bar with optional labels, customizable positioning, and support for multiple unit systems (SI length, imperial, astronomical, angle, pixel-based, and reciprocal dimensions). The scale bar integrates directly into matplotlib's artist system—you create a ScaleBar object, add it to an axes via add_artist(), and configure appearance through constructor arguments or matplotlibrc settings. It's designed for scientific imaging workflows where pixel dimensions are known and need visual representation on output plots or saved figures. Use it for: - Annotate microscopy images with a calibrated scale bar showing micrometers or nanometers. - Display geospatial plots with distance references using UTM or lat/lon coordinate systems. - Save publication-quality scientific figures with scale information preserved at original resolution. - Add dimension references to satellite or aerial imagery without modifying the underlying data. - Customize scale bar appearance to match journal or presentation requirements. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Adds a matplotlib artist that renders a calibrated scale bar on images, with customizable size, position, units, and appearance. Yes. Low install friction, no security issues, permissive license, and recent maintenance make it a safe choice. Install if you regularly plot calibrated images and need a standard way to display scale information; skip if you never use imshow() or prefer manual annotation. ## Install pip install matplotlib-scalebar uv add matplotlib-scalebar poetry add matplotlib-scalebar ## Installing matplotlib-scalebar Before you install: Low friction: single runtime dependency on matplotlib, pure Python wheel. Repository shows recent activity (last commit 2025-01-17) and stable release history since 2016, though marked dormant. License in practice: Permissive license (BSD) allows use in commercial and proprietary projects with minimal restrictions. Quickstart: pip install matplotlib-scalebar import matplotlib.pyplot as plt from matplotlib_scalebar.scalebar import ScaleBar fig, ax = plt.subplots() ax.imshow(image_array, cmap="gray") scalebar = ScaleBar(0.08, "cm", length_fraction=0.25) ax.add_artist(scalebar) plt.show() Requires matplotlib as a runtime dependency. Verify before relying: - Whether the package supports all matplotlib backends equally or has known limitations with certain renderers. - Performance characteristics when rendering scale bars on very large images or in animation loops. - Full extent of customization options beyond those shown in the provided examples. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 148.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags matplotlib scale bar, image calibration bar, micron bar matplotlib, pixel size visualization, scientific image annotation, scientific-visualization, image-annotation [View on SkillFed](https://skillfed.io/packages/matplotlib-scalebar) · [View on PyPI](https://pypi.org/project/matplotlib-scalebar/)