Skip to content Skip to sidebar Skip to footer

Python, Matplotlib, Plotting Irregular Grid

In Matplotlib, I am trying to plot the following grid: The following formula gives me the length of each row: xlen_max = 4 ylen = 7 for g in range(ylen): xlen = min(ylen-g, xl

Solution 1:

You can use axe.set_visible(False) to set invisible the axes that you don't need. Here is a example:

cnt = 1
fig, axes = plt.subplots(7, 4 , figsize=(5, 5))
for i, row inenumerate(axes):
    for j, axe inenumerate(row):
        if i > 3:
            if j > 3 - cnt:
                axe.set_visible(False)
    if i > 3:
        cnt += 1

enter image description here

Post a Comment for "Python, Matplotlib, Plotting Irregular Grid"