atompy.Hist2d.for_imshow#

property Hist2d.for_imshow#

Return corresponding ImshowData object.

Assumes that the origin of the image is specified by matplotlib.rcParams[“image.origin”]

Returns:
imshow_dataImshowData

A data type storing an image and the extent of the image.

  • imshow_data.image: 2d pixel array

  • imshow_data_extent: the extents of the image

Examples

hist = Hist2d(*np.histogram2d(xsamples, ysamples))
image, extent = hist.for_imshow
plt.imshow(image, extent=extent)

# or (calling *imshow_data* returns a dictionary)
plt.imshow(**hist.for_imshow())

# or
imshow_data = hist.for_imshow
plt.imshow(imshow_data.image, extent=imshow_data.extent)