def create_limit(x, ylim, upper=False): X = np.concatenate((x, np.flip(x)), 0) if upper == True: y0 = 100 * np.ones(len(x)) * ylim.unit else: y0 = np.zeros(len(x)) * ylim.unit y1 = ylim * np.ones(len(x)) Y = np.concatenate((y0, y1), 0) XY = np.vstack((X, Y)).T lim_region = Polygon(XY, facecolor='k', alpha=0.8) lim_region.set_hatch('/') return lim_region
figs[-1].append("internal-one") colorCont = 0 listColor = False hatch = False for f in figs: # all internal faces will be filled with a hatch pattern in the plot if f[-1] == "internal-one": hatch = True # if f is an internal face that is part of a list, keep the same color if f[-1] == "internal-list" and not listColor: listColor = True hatch = True if f[-1] != "internal-list" and listColor: listColor = False hatch = False fg = f[:-2] xp = [p[0] for p in fg] yp = [p[1] for p in fg] ax1.scatter(xp, yp, s=(50 * len(colors)) - 50 * colorCont, marker=markers[colorCont % len(colors)], zorder=5 * colorCont, color=colors[colorCont % len(colors)]) p = Polygon(np.array(fg), facecolor=colors[colorCont % len(colors)], alpha=0.3, edgecolor=colors[colorCont % len(colors)], lw=(2 * len(colors)) - 1 * colorCont, label=f[-2]) if hatch: p = Polygon(np.array(fg), facecolor='none', alpha=0.3, edgecolor=colors[colorCont % len(colors)], lw=4, label=f[-2]) p.set_hatch('o') ax1.add_patch(p) if not listColor: colorCont += 1 #plt.gca().axes.get_yaxis().set_visible(False) plt.legend(loc="lower center") plt.show()