handley-lab/fgivenx

Better fineness handling

Closed this issue · 2 comments

Describe the bug (bug?)

The filled contour levels for e.g. fineness=0.5 and contours [1,2] are [0.5,1,1.5,2,2.5], with fineness=0.1 it goes up to 2.9 -- I find this unintuitive and would expect filled contours only up to the highest contour level passed.

This comes from the np.arange here:

default_color_levels = numpy.arange(0, contour_line_levels[-1] + 1, fineness)

I would suggest changing it to

default_color_levels = numpy.arange(0, contour_line_levels[-1] + fineness/2, fineness)

or adding a flag to choose the behavior to use.

PS: A related typo in the documentation is Spacing of contour color levels. (Default: 0.1) while 0.5 is the default. [plot() in plot.py]

I agree that this definitely does not fulfil the principle of least astonishment at the moment -- feel free to submit a PR with these changes

Solved a while ago by #15, closing this here