-
Notifications
You must be signed in to change notification settings - Fork 224
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
Plot square or cube by default for geopandas Point/MultiPoint types #1405
Plot square or cube by default for geopandas Point/MultiPoint types #1405
Conversation
I am not very happy with my solution. So if you have an idea for better implementation ill be happy to know. |
…it is not a string)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've got the right idea here to check for an attribute that only geopandas.GeoDataFrame objects have 😄 I've offered a few suggestions that can help to improve things a bit.
Once we settle on the if-statement condition, it would be good to:
- copy the same chunk of code to
plot3d.py
. - Add a unit test to
test_geopandas.py
to ensure this works. Are you interested in learning about unit test writing? If so, we can give you some tips on that.
P.S. I've converted this Pull Request (PR) to draft mode to save on Continuous Integration resources (test will only run on Linux instead of all 3 OS types). We will convert the PR back to non-draft mode once things are more polished.
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Wei Ji <[email protected]>
Hmm, you're right. Let's go back to square 0.2cm then for |
it's O.K. now I'll be happy to learn about the tests. thanks! |
Alright! Testing involves checking that code produces the expected behaviour. Specifically, you'll need to write some new test functions to put in The test itself can be adapted from what you did in #1405 (comment). You might also find the examples in @pytest.mark.mpl_image_compare
def test_geopandas_plot_default_square():
"""
"""
point = shapely.geometry.Point(...)
gdf = gpd.GeoDataFrame(...)
fig = Figure()
fig.plot(data=gdf, ...)
return fig Start with the above for a 2D plot with a Point type geometry, and once you've got the hang of it, try making a 3D plot with a MultiPoint type geometry. Good luck! |
@weiji14 can you please add me as a collaborator at DAGshub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dvc image diff test fails. Is that caused by the draft status or went something wrong with the upload @weiji14 ?
dvc image failure is not a problem, see this post for an explanation #1405 (comment). |
Please hold off merging this PR and see my comment in #1373 (comment) first. |
I think we also need to add two tests to make sure users can plot the symbols using other styles when passing |
I'll add them |
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
great thanks for the review! |
Ping @weiji14 and @michaelgrund to give this PR another round of final review, because this PR has changed a little after you approved it. |
I think it looks fine, just need to incorporate the suggestions at #1405 (comment) and should be good to merge 😄 |
Co-authored-by: Michael Grund <[email protected]>
Co-authored-by: Michael Grund <[email protected]>
Sorry did not notice them, committed the changes. |
Cool, I'll merge this PR in now, thanks again @yohaimagen! |
…enericMappingTools#1405) Set default behavior for plotting geopandas dataframe with Point/Multipoint type geometry as points (-Sp0.2c) for `plot` and cubes (-Su0.2c) for `plot3d`, instead of GMT's default line style plot. * testing default behavior of plot and plot3d with geopandas Point and MultiPoint DataFrames * adding test for non default style * adding a comment explaining the if statment Co-authored-by: Wei Ji <[email protected]> Co-authored-by: Michael Grund <[email protected]> Co-authored-by: Dongdong Tian <[email protected]>
In response to issue #1373 adding if statement to the plot function to create desirable default behavior for plotting geopandas dataframe with points data(geometry) to be plotted as points instead of a line.
Fixes #1373