From a7a5fe36f9ed2a9ec0692d95c3d9156e09ec7617 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 26 Feb 2018 10:03:02 +0100 Subject: [PATCH] default to a bar width of _bar_width for bar plots with only one data point --- src/recipes.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/recipes.jl b/src/recipes.jl index b7c80c5d..aa37ee5c 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -317,7 +317,11 @@ end # compute half-width of bars bw = plotattributes[:bar_width] hw = if bw == nothing - 0.5*_bar_width*ignorenan_minimum(filter(x->x>0, diff(procx))) + if nx > 1 + 0.5*_bar_width*ignorenan_minimum(filter(x->x>0, diff(procx))) + else + 0.5 * _bar_width + end else Float64[0.5_cycle(bw,i) for i=1:length(procx)] end