AxisPlot extends the functionality of Matplotlib's imshow() function by appending up to four plots to the image, at the top, bottom, left, and/or right. The additional plots contain the output of operations that are performed along the two axes. Plots at the top and bottom contain the output of operations performed along the vertical axis, while plots on the left and right contain the output of operations that are performed along the horizontal axis. For example, the screenshot below shows an AxisPlot with the mean of the image computed along the vertical axis, shown at the top, and the sum of the image computed along the horizontal axis, shown on the right.
importnumpyasnpimportmatplotlib.pyplotaspltimportaxisplotasap# generate some datadim_x=512dim_y=256x=np.linspace(0, 2*np.pi, dim_x)
X=np.random.normal(size=(dim_y, dim_x)) +np.sin(x)
# create axisplot with mean along the y-axis at the top, and sum along the# x-axis on the rightaxisplot=ap.AxisPlot(optop=np.mean, opright=np.sum, cmap='plasma')
ax, ax_top, ax_right=axisplot.plot(X)
ax_top.set_title('Example')
# another example, using an operation (percentile) that takes arguments# axisplot = ap.AxisPlot(optop=np.percentile, topargs={'a': X, 'q': 95})# axisplot.plot(X)plt.show()Development mode:
cd <axisplot-directory> pip install -e .
cd <axisplot-directory> python -m unittest
AxisPlot is distributed under WTFPLv2.
