-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix/Scatter plot density with few points #478
Conversation
Closes #381 |
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.
@ecomodeller - why are the type checking suddenly failing... ? mypy modelskill/ --config-file pyproject.toml |
The ones related to MIKE IO fails because the last release includes a The ones related to NumPy is likely related to some changes in the last release two days ago.https://pypi.org/project/numpy/2.2.0/ Seems like we should be using numpy.typing.NDArray instead of numpy.ndarray to make mypy happy. |
Hmm, but that seems like something that should be fixed in another PR. I looked at https://numpy.org/doc/stable/reference/typing.html and consider if we should actually use np.typing.ArrayLike? |
Fix some static type info
…odelskill into scatter-density-few-points
@ecomodeller, I have updated the code to consistently show the colorbar when relevant (referring to your comment and screenshots above). Could you please review? |
Scatter plot can fail when strange error message if you trying to plot only few points. The problem is the density calculation which anyway does not make sense for few points. The solution in this PR is to change the default behavior of show_density if number of points is less than 200 to False.
Note that if user manually sets show_density=True or a very high number of bins are used, the same error could still occur. So it would be even better to catch the problem in the code and issue a better error message that could help the user.