# Generated by pandoc-plot 1.9.1
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(2019)

from skued import diffread, autocenter
from pathlib import Path
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from skimage.transform import rotate

im = diffread(Path("images") / "autocenter" / "graphite.tif")
mask = diffread(Path("images") / "autocenter" / "graphite_mask.tif")
r, c = autocenter(im=im, mask=mask)
im = rotate(im, center=(c, r), angle=8, mode="reflect", preserve_range=True)

fig, ax = plt.subplots(1, 1, figsize=(4, 4))

ax.imshow(im, vmin=0, vmax=200, cmap="inferno")

pair1 = [
    mpatches.Circle(xy=(c - 281, r), radius=35, ec="w", fc="none"),
    mpatches.Circle(xy=(c + 281, r), radius=35, ec="w", fc="none"),
]

pair2 = [
    mpatches.Circle(xy=(c - 138, r + 246), radius=35, ec="r", fc="none"),
    mpatches.Circle(xy=(c + 138, r - 246), radius=35, ec="r", fc="none"),
]

for p in pair1 + pair2:
    ax.add_patch(p)
ax.axis("off")

plt.tight_layout()
Click here to see how this plot was generated.