Aug-17-2020, 03:27 PM
I'm completely new to Python and can't figure out what search terms to use to find the answer. I'm plotting very small images from a CCD and would like the grid/axes (0, 0) point to be in the lower left corner - not the middle of the rows/columns; that aligns the grid to the middle of the pixels. Here is the code I'm using for a 5 pixel x 5 pixel image showing a very "zoomed in" view of the CCD:
import matplotlib.pyplot as plt import numpy as np image = [[175.94289, 177.74895, 158.87912, 145.34993, 148.05937], [177.55653, 165.20393, 160.09775, 161.71048, 149.43646], [162.94765, 160.01396, 204.08203, 289.2722, 221.55945], [147.64162, 153.57835, 331.3954, 383.78668, 233.15973], [146.21872, 154.15912, 230.50053, 234.13762, 186.50993]] npimage = np.array(image) fig = plt.figure(figsize=(5, 5)) axes = fig.add_axes plt.imshow(npimage, origin='lower', cmap='YlGnBu_r', vmax=np.percentile(npimage, 98), vmin=np.percentile(npimage, 5)) plt.xlabel('Image Column', fontsize=14) plt.ylabel('Image Row', fontsize=14) plt.grid(axis='both', color='white', ls='solid') plt.show()