Merge branch 'tick-format' of https://github.com/yha/Plots.jl into tick-format

This commit is contained in:
yha 2020-08-12 16:05:23 +03:00
parent f23e6c224d
commit bd7f0dc8d4
2 changed files with 12 additions and 8 deletions

View File

@ -20,9 +20,13 @@ using UUIDs
# ---------------------------------------------------------------- # ----------------------------------------------------------------
function labelfunc(scale::Symbol, backend::PlotlyBackend) function labelfunc(scale::Symbol, backend::PlotlyBackend)
f = scale == :log10 ? x->"10<sup>$x</sup>" : identity texfunc = labelfunc_tex(scale)
# replace dash with \minus (U+2212) function (x)
x -> replace(f(x), "-" => "") tex_x = texfunc(x)
sup_x = replace( tex_x, r"\^{(.*)}"=>s"<sup>\1</sup>" )
# replace dash with \minus (U+2212)
replace(sup_x, "-" => "")
end
end end
function plotly_font(font::Font, color = font.color) function plotly_font(font::Font, color = font.color)
@ -342,7 +346,7 @@ function plotly_legend_pos(pos::Symbol)
ybot = 0.07 ybot = 0.07
ytop = 1.0 ytop = 1.0
xcenter = 0.55 xcenter = 0.55
ycenter = 0.52 ycenter = 0.52
center = 0.5 center = 0.5
youtertop = 1.1 youtertop = 1.1
youterbot = -0.15 youterbot = -0.15
@ -357,9 +361,9 @@ function plotly_legend_pos(pos::Symbol)
bottomright = (coords = [1.0, ybot], xanchor = "right", yanchor = "bottom"), bottomright = (coords = [1.0, ybot], xanchor = "right", yanchor = "bottom"),
topright = (coords = [1.0, 1.0], xanchor = "right", yanchor = "top"), topright = (coords = [1.0, 1.0], xanchor = "right", yanchor = "top"),
topleft = (coords = [xleft, 1.0], xanchor = "left", yanchor = "top"), topleft = (coords = [xleft, 1.0], xanchor = "left", yanchor = "top"),
outertop =(coords = [center, youtertop ], xanchor = "upper", yanchor = "middle"), outertop =(coords = [center, youtertop ], xanchor = "upper", yanchor = "middle"),
outerbottom =(coords = [center, youterbot], xanchor = "lower", yanchor = "middle"), outerbottom =(coords = [center, youterbot], xanchor = "lower", yanchor = "middle"),
outerleft =(coords = [xouterleft, center], xanchor = "left", yanchor = "top"), outerleft =(coords = [xouterleft, center], xanchor = "left", yanchor = "top"),
outerright =(coords = [xouterright, center], xanchor = "right", yanchor = "top"), outerright =(coords = [xouterright, center], xanchor = "right", yanchor = "top"),
outertopleft =(coords = [xouterleft, ytop], xanchor = "upper", yanchor = "left"), outertopleft =(coords = [xouterleft, ytop], xanchor = "upper", yanchor = "left"),
outertopright = (coords = [xouterright, ytop], xanchor = "upper", yanchor = "right"), outertopright = (coords = [xouterright, ytop], xanchor = "upper", yanchor = "right"),

View File

@ -1069,7 +1069,7 @@ guidefont(ax::Axis) = font(
# --------------------------------------------------------------- # ---------------------------------------------------------------
# converts unicode scientific notation, as returned by Showoff, # converts unicode scientific notation, as returned by Showoff,
# to a tex-like format (supported by gr, pyplot, and gpfplot). # to a tex-like format (supported by gr, pyplot, and pgfplots).
function convert_sci_unicode(label::AbstractString) function convert_sci_unicode(label::AbstractString)
unicode_dict = Dict( unicode_dict = Dict(