I have a 4x4 grid having 16 subplots. I am using floating_axes.FloatingSubplot method to rotate all the axes in my figure. How should I pass the subplot-number as it takes axes but as three digit number, see this. Now since I am having more than 9 subplots I dont know how to pass the subplot-number to the FloatingSubplot method.
Code:-
from mpl_toolkits.axisartist.grid_finder import DictFormatter
from matplotlib.transforms import Affine2D
import mpl_toolkits.axisartist.floating_axes as floating_axes
import matplotlib.pyplot as plt
def setup_axes1(fig, ax, angle):
tr = Affine2D().scale(2, 2).rotate_deg(angle)
grid_helper = floating_axes.GridHelperCurveLinear(
tr, extremes=(0, 11, 0, 11)
)
ax1 = floating_axes.FloatingSubplot(fig, ax, grid_helper=grid_helper)
ax1.axis("off")
ax1.axis["bottom"].set_visible(False)
ax1.axis["top"].set_visible(False)
ax1.axis["right"].set_visible(False)
ax1.axis["left"].set_visible(False)
fig.add_subplot(ax1)
aux_ax = ax1.get_aux_axes(tr)
return aux_ax
fig, axes = plt.subplots(nrows=4, ncols=3, figsize=(16,30), facecolor="#222222")
for index, ax_ in enumerate(fig.get_axes(), start=1):
fig.delaxes(ax_)
## HERE IS THE PROBLEM PASSING 430 + INDEX FAILS AT 430 + 10
ax = setup_axes1(fig, 430 + index, -45)
ax.set_aspect("equal")
temp_count = 1
start, end = 1, 10
for i in range(start, end+1):
count = 0
for j in range(end-i+1, end+1):
if temp_count <= 55:
color, radius, hatch_num, lw, fill = "gold", 0.4, 0, 1, "gold"
else:
color, radius, hatch_num, lw, fill = "grey", 0.27, 5, 0, None
count += 1
circle = plt.Circle((count, j), radius=radius, linewidth=lw, fill=fill, hatch=hatch_num*'-', color=color)
ax.add_artist(circle)
temp_count += 1
for i in range(start+1, end+1):
count = i
for j in range(start, end+1-i+1):
if temp_count <= 55:
color, radius, hatch_num, lw, fill = "gold", 0.4, 0, 1, "gold"
else:
color, radius, hatch_num, lw, fill = "#F2F2F2", 0.3, 3, 0, None
circle = plt.Circle((count, j), radius=radius, linewidth=lw, fill=fill, hatch=hatch_num*'-', color=color)
ax.add_artist(circle)
count += 1
temp_count += 1
# plt.show()
Can someone help?
