Created
June 10, 2021 13:47
-
-
Save cvanelteren/c975fc161b8e203b565921ceac39760e to your computer and use it in GitHub Desktop.
Example of mosaic_layouts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt, cmasher as cmr | |
import numpy as np | |
layout = np.zeros((10, 10), dtype = object) | |
layout[-1, :] = np.arange(1, 11) | |
layout[:, -1] = np.arange(20, 30) | |
fig = plt.figure(constrained_layout = 1) | |
axs = fig.subplot_mosaic(layout) | |
ax = axs.get(-1) | |
from matplotlib.patches import ConnectionPatch | |
for i in layout.flat: | |
axi = axs.get(i) | |
# arrow stuff | |
# xyA = (0, .5) | |
# xyB = xy[i] | |
# p = ConnectionPatch(xyA = xyA, xyB = xyB, coordsA = axi.transAxes, | |
# coordsB = ax.transData, | |
# color = 'gray', | |
# arrowstyle= '->', | |
# shrinkB = 2, | |
# mutation_scale= 10, | |
# linewidth = 2, | |
# connectionstyle= 'arc3, rad=.1') | |
#fig.add_artist(p) | |
fig.subplots_adjust(hspace = .2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment