{"id":7505,"library":"plotbin","title":"PlotBin","description":"The PlotBin package is a Python library, currently at version 3.1.8, developed by Michele Cappellari. It provides specialized utilities for plotting binned maps and other general two-dimensional data visualizations. Primarily aimed at scientific research and development, particularly in fields like astronomy and astrophysics, its documentation is embedded within the source code file headers. The project maintains an active status with irregular but consistent updates, with the latest release in September 2025.","status":"active","version":"3.1.8","language":"en","source_language":"en","source_url":"https://www-astro.physics.ox.ac.uk/~mxc/software/#plotbin","tags":["plotting","data visualization","scientific computing","astronomy","astrophysics","binned maps","matplotlib"],"install":[{"cmd":"pip install plotbin","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for numerical operations and data array handling, fundamental for binned map data.","package":"numpy","optional":false},{"reason":"Provides the underlying plotting backend for generating visualizations.","package":"matplotlib","optional":false}],"imports":[{"note":"The primary plotting functions are typically imported directly from submodules, not the top-level package or as a single module object.","wrong":"import plotbin.display_bins","symbol":"display_bins","correct":"from plotbin.display_bins import display_bins"}],"quickstart":{"code":"import numpy as np\nfrom plotbin.display_bins import display_bins\nimport matplotlib.pyplot as plt\n\n# Simulate some binned data (e.g., from a galaxy observation)\nx = np.random.rand(100) * 10\ny = np.random.rand(100) * 10\nz = np.sin(x/2) + np.cos(y/2) + np.random.rand(100) * 0.5\n\n# Create a simple display_bins plot\nfig, ax = plt.subplots(figsize=(7, 6))\ndisplay_bins(x, y, z, ax=ax, cmap='viridis', textcolor='white')\nax.set_title('Example Binned Map with PlotBin')\nax.set_xlabel('X-coordinate')\nax.set_ylabel('Y-coordinate')\nplt.colorbar(ax.collections[0], ax=ax, label='Value')\nplt.show()","lang":"python","description":"This quickstart demonstrates how to generate a binned 2D map using `plotbin.display_bins`. It simulates random x, y coordinates and associated 'z' values, then visualizes their binned representation with Matplotlib. It assumes a basic setup where x, y, and z represent data points and their corresponding values in a 2D space."},"warnings":[{"fix":"Ensure you are using the correct submodule import paths as shown in recent examples, e.g., `from plotbin.display_bins import display_bins`. Refer to the latest file headers for definitive import patterns.","message":"Older versions of 'plotbin' might have used different import paths, potentially leading to `ImportError`. A changelog from a related project (pafit) noted 'Changed imports for plotbin as package'.","severity":"breaking","affected_versions":"<= 2.x (approximate, specific version unknown)"},{"fix":"Review the license details on PyPI or in the source code file headers to ensure compliance with usage restrictions, especially for commercial projects or redistribution.","message":"The PlotBin library is distributed under a restrictive, non-commercial license. Permission to use is for non-commercial purposes only, and redistribution of the code is not allowed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When seeking detailed usage, function signatures, or examples, consult the source code files directly after installation or by browsing the project's homepage if available.","message":"Official documentation for PlotBin is primarily contained within the file headers of the source code, rather than a separate documentation website or extensive README.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Verify that `plotbin` is installed (`pip show plotbin`). If installed, ensure your import statement matches the current package structure, e.g., `from plotbin.display_bins import display_bins`. If the error persists, consider reinstalling with `pip install --upgrade plotbin` to get the latest version.","cause":"The `plotbin` package or the `display_bins` submodule is not installed or the import path is incorrect. This can happen if an older version of plotbin was installed or the package structure changed.","error":"ModuleNotFoundError: No module named 'plotbin.display_bins'"},{"fix":"Check the function signature in the source code's file headers for the `display_bins` function to understand its expected arguments. If an `ax` argument is not supported, you might need to create the plot on the current active Axes or manually integrate it with Matplotlib's object-oriented interface. Update `plotbin` if a newer version supports the `ax` argument.","cause":"The `display_bins` function (or a similar plotting function) was called with an `ax` argument, but that specific version or function might not support directly passing a Matplotlib Axes object, or expects it as a positional argument.","error":"TypeError: display_bins() got an unexpected keyword argument 'ax'"}]}