diff --git a/README.rst b/README.rst index 065a57a..5f2b877 100644 --- a/README.rst +++ b/README.rst @@ -3,7 +3,7 @@ fgivenx: Functional Posterior Plotter ===================================== :fgivenx: Functional Posterior Plotter :Author: Will Handley -:Version: 2.3.0 +:Version: 2.4.0 :Homepage: https://github.com/williamjameshandley/fgivenx :Documentation: http://fgivenx.readthedocs.io/ diff --git a/fgivenx/plot.py b/fgivenx/plot.py index 39522c7..8b61596 100644 --- a/fgivenx/plot.py +++ b/fgivenx/plot.py @@ -38,11 +38,11 @@ def plot(x, y, z, ax=None, **kwargs): Thickness of contour lines. (Default: 0.3) contour_color_levels: List[float], optional - Contour color levels. - (Default: `numpy.arange(0, contour_line_levels[-1] + 1, fineness)`) + Contour color levels. (Default: + `numpy.arange(0, contour_line_levels[-1] + fineness / 2, fineness)`) fineness: float, optional - Spacing of contour color levels. (Default: 0.1) + Spacing of contour color levels. (Default: 0.5) lines: bool, optional (Default: True) @@ -69,7 +69,8 @@ def plot(x, y, z, ax=None, **kwargs): contour_line_levels = kwargs.pop('contour_line_levels', [1, 2, 3]) fineness = kwargs.pop('fineness', 0.5) - default_color_levels = numpy.arange(0, contour_line_levels[-1] + 1, + default_color_levels = numpy.arange(0, + contour_line_levels[-1] + fineness / 2, fineness) contour_color_levels = kwargs.pop('contour_color_levels', default_color_levels) diff --git a/fgivenx/test/test_plot.py b/fgivenx/test/test_plot.py index 31fb776..bd5defc 100644 --- a/fgivenx/test/test_plot.py +++ b/fgivenx/test/test_plot.py @@ -31,6 +31,14 @@ def test_plot_transparent(): cbar = plot(x, y, z, ax, alpha=0.7) assert type(cbar) is matplotlib.contour.QuadContourSet +def test_plot_fineness(): + x, y, z = gen_plot_data() + + fig, ax = plt.subplots() + cbar = plot(x, y, z, ax, fineness=0.1, contour_line_levels=[1,2,3,4]) + assert type(cbar) is matplotlib.contour.QuadContourSet + assert len(cbar.levels) == 41 + def test_plot_wrong_argument(): x, y, z = gen_plot_data() diff --git a/planck.png b/planck.png index b0c68b0..16ff60c 100644 Binary files a/planck.png and b/planck.png differ diff --git a/plot.png b/plot.png index 5618d22..c785c23 100644 Binary files a/plot.png and b/plot.png differ