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

Fixed unintuitive fineness behaviour #15

Merged

Conversation

Stefan-Heimersheim
Copy link
Collaborator

@Stefan-Heimersheim Stefan-Heimersheim commented Aug 24, 2021

Description

Fixes issue #13 by making fineness behaviour more intuitive, i.e. the default filled color contour levels for e.g. fineness=0.5 and contours [1,2] are now [0.5,1,1.5,2,2] instead of [0.5,1,1.5,2,2,2.5].

Edit: Also quite visible in the colorbar, e.g. for [1,2] sigma contours. It now stretches from 0 to 2 sigma, instead of from 0 to 2.75 sigma (fineness=0.25):
Figure_1

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

I guess it is technically breaking as the default_color_levels arguments will work slightly different.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • test_plot_fineness() in test_plot.py
  • Tested it in my own codes
  • cbar = plot(x, y, z, ax, fineness=0.5, contour_line_levels=[1,2]) looks as expected
    Figure_1
  • cbar = plot(x, y, z, ax, fineness=0.3, contour_line_levels=[1,2]) (no one would use non-integer levels/fineness but just to check) looks as expected:
    Figure_1

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@Stefan-Heimersheim
Copy link
Collaborator Author

I think I'm happy with this now, only not completely sure about the formatting of the docstring (added line break due to width limit).

Copy link
Collaborator

@williamjameshandley williamjameshandley left a comment

Choose a reason for hiding this comment

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

I think that this is a much more sensible behaviour

As this is a defaults change could you bump the version number in the README to 2.4.0, and I'll then update the pip from that once it's merged. Could you also re-run the examples in the readme so that the figures are updated?

@Stefan-Heimersheim
Copy link
Collaborator Author

Sorry for the delay here as well, I bumped the version and reran the plots.

Note that my plot boundaries were different (x axis went to [-20,20] in all plots) so I added

ax_samples.set_xlim(-20,20)
ax_samples.set_ylim(-20,20)
ax_lines.set_xlim(-2,2)
ax_fgivenx.set_xlim(-2,2)
ax_dkl.set_xlim(-2,2)

to the first plot, it still changes the limits of the plots but just slightly.

Copy link
Collaborator

@williamjameshandley williamjameshandley left a comment

Choose a reason for hiding this comment

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

Many thanks @Stefan-Heimersheim. Please squash and merge.

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.

2 participants