From d30574de24d4da607b5cc2f4f539eef77de06c0e Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Wed, 11 May 2016 15:01:17 +0200 Subject: [PATCH] workaround a bug in engineering notation for colors in pgfplot --- src/backends/pgfplots.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index a48f0e12..3ba2bd36 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -108,7 +108,12 @@ const _pgfplots_legend_pos = KW( function _pgfplots_get_color(kwargs, symb) c = typeof(kwargs[symb]) == Symbol ? convertColor(kwargs[symb]) : kwargs[symb].c - "{rgb,1:red,$(float(c.r));green,$(float(c.g));blue,$(float(c.b))}" + # We need to convert to decimals here because pgfplot will error + # for colors in engineering notation + r_str = @sprintf("%.8f", float(c.r)) + g_str = @sprintf("%.8f", float(c.g)) + b_str = @sprintf("%.8f", float(c.b)) + "{rgb,1:red,$(r_str);green,$(g_str);blue,$(b_str)}" end function _pgfplots_get_linestyle!(kwargs, plt)