workaround a bug in engineering notation for colors in pgfplot

This commit is contained in:
Kristoffer Carlsson 2016-05-11 15:01:17 +02:00
parent e8cdff2310
commit d30574de24

View File

@ -108,7 +108,12 @@ const _pgfplots_legend_pos = KW(
function _pgfplots_get_color(kwargs, symb) function _pgfplots_get_color(kwargs, symb)
c = typeof(kwargs[symb]) == Symbol ? convertColor(kwargs[symb]) : kwargs[symb].c 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 end
function _pgfplots_get_linestyle!(kwargs, plt) function _pgfplots_get_linestyle!(kwargs, plt)