Skip to content

Move choropleth to class #1011

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

Merged
merged 13 commits into from
Nov 7, 2018

Conversation

Conengmo
Copy link
Member

@Conengmo Conengmo commented Nov 6, 2018

Closes #981.

I have been meaning to do this for a while now :) Moving the Map.choropleth() method to its own class, so it's similar to all other folium types. This is not a super important change, but I think it makes our code base more consistent, which is good for developers, and makes our API more consistent, which is good for users.

I haven't changed any functionality, except:

  • Choropleth accepts show, overlay and control arguments like other layer types.
  • Made Choropleth a subclass of FeatureGroup and tweaked the rendering.
  • Removed the reset option, since it didn't do anything.
  • Map.choropleth method still works but raises a FutureWarning

Note about ColorMap:
It needs Map as its parent, or we'd have to change branca. Also it cannot be included in the FeatureGroup, so it cannot be toggled in layer control.

Links to the changed notebooks:
Quickstart.ipynb
GeoJSON_and_choropleth.ipynb

I made sure the tests still work and updated the example notebooks. Didn't add a line to the changelog yet.

@ocefpaf or @jtbaker, want to review this one?

@Conengmo Conengmo added the waiting for review PR is waiting to be reviewed label Nov 6, 2018
@ocefpaf ocefpaf self-assigned this Nov 7, 2018
Copy link
Member

@ocefpaf ocefpaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The long term goal was to remove choropleth entirely and leave only the GeoJson class. I guess that people rely on it so much that we are promoting it to a first class citizen in folium again 😄

@ocefpaf ocefpaf merged commit 5d029e7 into python-visualization:master Nov 7, 2018
@Conengmo Conengmo removed the waiting for review PR is waiting to be reviewed label Nov 7, 2018
@Conengmo Conengmo deleted the choropleth-refactor branch November 7, 2018 13:14
@Conengmo
Copy link
Member Author

Conengmo commented Nov 7, 2018

Thanks for the review and merge @ocefpaf. I agree it's a bit of an outlier but it seems much used given the number of issues we get on it.

By the way, the commits weren't squashed. Did the default setting changed? I'm not paying much attention to my commits since I thought we're squashing .

@ocefpaf
Copy link
Member

ocefpaf commented Nov 7, 2018

Did the default setting changed?

Probably. I did not noticed that :-/

I'm not paying much attention to my commits since I thought we're squashing .

Same here. Not a big deal though. I'll take a better look next time before merging.

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

Successfully merging this pull request may close these issues.

3 participants