diff --git a/gnuplot/src/axes_common.rs b/gnuplot/src/axes_common.rs index c6db9968..2684d0c5 100644 --- a/gnuplot/src/axes_common.rs +++ b/gnuplot/src/axes_common.rs @@ -1395,9 +1395,9 @@ impl AxesCommonData } Custom(ref entries) => { - if entries.is_empty() + if entries.len() < 2 { - panic!("Need at least 1 element in a custom palette"); + panic!("Need at least 2 elements in a custom palette"); } write!(w, "set palette defined ("); diff --git a/gnuplot/src/options.rs b/gnuplot/src/options.rs index 1606d0f7..d3334016 100644 --- a/gnuplot/src/options.rs +++ b/gnuplot/src/options.rs @@ -421,7 +421,7 @@ pub enum PaletteType /// Use a cube helix palette, with a certain start (in radians), cycles, saturation and gamma. CubeHelix(f32, f32, f32, f32), /// A custom palette - /// is specified by a sequence of 4-tuples (with at least one element). The first + /// is specified by a sequence of 4-tuples (with at least two elements). The first /// element is the grayscale value that is mapped to the remaining three elements /// which specify the red, green and blue components of the color. /// The grayscale values must be non-decreasing. All values must range from 0 to 1.