Fixed broken behaviour for function :formatter, and pgfplots

This commit is contained in:
Fedor Bezrukov 2018-03-21 09:54:52 +00:00
parent 4e5c88eb74
commit bd06f0c713
2 changed files with 6 additions and 5 deletions

View File

@ -223,8 +223,8 @@ function gr_polaraxes(rmin::Real, rmax::Real, sp::Subplot)
sinf = sind.(a) sinf = sind.(a)
cosf = cosd.(a) cosf = cosd.(a)
rtick_values, rtick_labels = get_ticks(yaxis) rtick_values, rtick_labels = get_ticks(yaxis)
if (yaxis[:formatter] == :scientific || any(contains.(rtick_labels,"×10"))) && yaxis[:ticks] in (:auto, :native) if yaxis[:formatter] in (:scientific, :auto) && yaxis[:ticks] in (:auto, :native)
rtick_labels = convert_sci_unicode(rtick_labels) rtick_labels = convert_sci_unicode.(rtick_labels)
end end
#draw angular grid #draw angular grid
@ -889,7 +889,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
# ensure correct dispatch in gr_text for automatic log ticks # ensure correct dispatch in gr_text for automatic log ticks
if xaxis[:scale] in _logScales if xaxis[:scale] in _logScales
dv = string(dv, "\\ ") dv = string(dv, "\\ ")
elseif xaxis[:formatter] == :scientific || contains(dv,"×10") elseif xaxis[:formatter] in (:scientific, :auto)
dv = convert_sci_unicode(dv) dv = convert_sci_unicode(dv)
end end
end end
@ -908,7 +908,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
# ensure correct dispatch in gr_text for automatic log ticks # ensure correct dispatch in gr_text for automatic log ticks
if yaxis[:scale] in _logScales if yaxis[:scale] in _logScales
dv = string(dv, "\\ ") dv = string(dv, "\\ ")
elseif yaxis[:formatter] == :scientific || contains(dv,"×10") elseif yaxis[:formatter] in (:scientific, :auto)
dv = convert_sci_unicode(dv) dv = convert_sci_unicode(dv)
end end
end end

View File

@ -329,7 +329,8 @@ function pgf_axis(sp::Subplot, letter)
push!(style, string(letter, "ticklabels = {\$", join(tick_labels,"\$,\$"), "\$}")) push!(style, string(letter, "ticklabels = {\$", join(tick_labels,"\$,\$"), "\$}"))
elseif axis[:showaxis] elseif axis[:showaxis]
tick_labels = ispolar(sp) && letter == :x ? [ticks[2][3:end]..., "0", "45"] : ticks[2] tick_labels = ispolar(sp) && letter == :x ? [ticks[2][3:end]..., "0", "45"] : ticks[2]
tick_labels = axis[:formatter] == :scientific ? string.("\$", convert_sci_unicode.(tick_labels), "\$") : tick_labels tick_labels = ( axis[:formatter] in (:scientific, :auto) ?
string.("\$", convert_sci_unicode.(tick_labels), "\$") : tick_labels )
push!(style, string(letter, "ticklabels = {", join(tick_labels,","), "}")) push!(style, string(letter, "ticklabels = {", join(tick_labels,","), "}"))
else else
push!(style, string(letter, "ticklabels = {}")) push!(style, string(letter, "ticklabels = {}"))