Задача получила своё решение, правда в слегка экзотическом стиле
Правда, проблема по сути никуда не ушла. Я вот теперь думаю, а как, допустим, полигон заштриховать....
Код: Выделить всё
import pysal as ps
import pandas as pd
import numpy as np
import geopandas as gpd
from matplotlib import pyplot as plt
from matplotlib.patches import Polygon
from matplotlib.lines import Line2D
from matplotlib.collections import PatchCollection
Код: Выделить всё
type_line=['High-High','Low-High','Low-Low','High-Low','NS']
type_color= ['#252525','#969696','#cccccc', '#636363','#f7f7f7']
fig=plt.figure()
ax = plt.subplot(2,3,CPOS)
ax.set_title('Local Moran`s I\n' + w)
for t,c in zip(type_line,type_color):
block=shape[shape.LISA_QUAD==t]
bx=[]
for cc in range(0,block.shape[0]):
poly=block[:].iloc[cc]
poly=poly['geometry']
x,y = poly.exterior.xy
dst=np.vstack([x,y])
dst=np.transpose(dst)
bx.append(Polygon(dst, True))
bx = PatchCollection(bx,label=t,edgecolor='black',color=c,linewidth=0.5)
ax.add_collection(bx)
circ1 = Line2D([0], [0], linestyle='', marker='s', markersize=15, markerfacecolor=type_color[0])
circ2 = Line2D([0], [0], linestyle='', marker='s', markersize=15, markerfacecolor=type_color[1])
circ3 = Line2D([0], [0], linestyle='', marker='s', markersize=15, markerfacecolor=type_color[2])
circ4 = Line2D([0], [0], linestyle='', marker='s', markersize=15, markerfacecolor=type_color[3])
circ5 = Line2D([0], [0], linestyle='', marker='s', markersize=15, markerfacecolor=type_color[4])
ax.legend((circ1, circ2, circ3,circ4,circ5), (type_line[0],type_line[1],type_line[2],type_line[3],type_line[4]), numpoints=1, loc='lower right')
ax.set_axis_off()
plt.axis('equal')