I am trying to do some maps of LISA CLUSTERS. O changed the code of lisa_cluster function to specify the colors I wanted. I used a generic 5 colors list, and changed it manually
from matplotlib import patches, colors
import palettable
palettable.colorbrewer.sequential.Greys_5_r.colors = [[60,60,60],[105,105,105],[0,0,255],[255,255,0],[240,240,240]]
paleta = palettable.colorbrewer.sequential.Greys_5_r.mpl_colormap
def lisa_cluster(moran_loc, gdf, p=0.05, ax=None,
legend=True, legend_kwds=None, **kwargs):
...
if ax is None:
figsize = kwargs.pop('figsize', None)
fig, ax = plt.subplots(1, figsize=figsize)
else:
fig = ax.get_figure()
gdf.assign(cl=labels).plot(column='cl', categorical=True,
k=2, cmap=paleta, linewidth=0.1, ax=ax,
edgecolor='white', legend=legend,
legend_kwds=legend_kwds, **kwargs)
ax.set_axis_off()
ax.set_aspect('equal')
return fig, ax
So I want that regions in each quadrant has the following collors:
1(HH)-Black
2(HL)-Dark gray
3(LL)-Yellow
4(LH) - Blue
Non significant - light gray
The problem is that the colors are MERGING and I do not know why.
I labeld the regions with their repectvly quadrant to show
2003 and 2004 are ok. At 2002 map, the colors yellow and blue ( and blue and light gray I think) merged