Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set customized cmap lisa_cluste() #81

Open
stevenlis opened this issue Jul 26, 2019 · 2 comments
Open

set customized cmap lisa_cluste() #81

stevenlis opened this issue Jul 26, 2019 · 2 comments

Comments

@stevenlis
Copy link

I came across the following problem:

https://gis.stackexchange.com/questions/329433/how-to-fix-colors-of-lisa-cluster-maps-from-pysal

I tried to set another colormap, such as

fig, ax = lisa_cluster(moran_loc, gdf, cmap='Blues')

TypeError: plot() got multiple values for keyword argument 'cmap'

hmap = colors.ListedColormap(colors5)
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=hmap, linewidth=0.1, ax=ax,
edgecolor='white', legend=legend,
legend_kwds=legend_kwds, **kwargs)

@slumnitz
Copy link
Member

@StevenLi-DS, thank you for the issue! We currently do not support the change of a cmap in lisa_cluster(). But I will have a look at it for a future release.

If you are interested in changing the colours and need a quick fix, I would recommend cloning the splot GitHub repo, installing splot from your local copy (e.g. installing splot as a developer with cd splot, pip install . in your chosen Conda environment) and changing the colours in: def mask_local_auto(moran_loc, p=0.5): found in _viz_utils.py.

There is a little bit of information on how to install splot for development here and I am happy to add some more in the coming weeks.

@liuxiawei
Copy link

Same problem. I think it's important and easily do it by dectect whether the cmap params passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants