Skip to content
Snippets Groups Projects
Commit d247b47f authored by Egor Sobolev's avatar Egor Sobolev
Browse files

Add option to draw data without antialiasing, and turn off colorbar

parent e78fc9de
No related branches found
No related tags found
No related merge requests found
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
from .geom import assemble_data, get_pixel_positions
......@@ -32,8 +31,8 @@ def plot_detector_layout(panels, figsize=(16, 16), **kwargs):
return fig, ax
def plot_data_on_detector(data, panels, figwidth=16, cmap=plt.cm.magma,
**kwargs):
def plot_data_on_detector(data, panels, colorbar=True, figwidth=16,
cmap=plt.cm.magma, **kwargs):
"""Plots data according to the detector geometry."""
if isinstance(panels, np.ndarray):
......@@ -51,15 +50,17 @@ def plot_data_on_detector(data, panels, figwidth=16, cmap=plt.cm.magma,
extent = (nx - xc + 0.5, -xc - 0.5, -yc - 0.5, ny - yc + 0.5)
im = ax.imshow(np.flip(img, axis=1), origin='lower',
extent=extent, vmin=0, vmax=1, cmap=cmap)
extent=extent, vmin=0, vmax=1, cmap=cmap,
interpolation="none")
ax.plot([-50, 50], [0, 0], 'r')
ax.plot([0, 0], [-50, 50], 'r')
ax.set_aspect('equal')
ax.axis(False)
ax_divider = make_axes_locatable(ax)
cax = ax_divider.append_axes("right", size="5%", pad="2%")
if colorbar:
ax_divider = make_axes_locatable(ax)
cax = ax_divider.append_axes("right", size="5%", pad="2%")
fig.colorbar(im, ax=ax, cax=cax)
fig.colorbar(im, ax=ax, cax=cax)
return fig, ax
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment