diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index d30653ba..c03f9b30 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -20,9 +20,13 @@ using UUIDs # ---------------------------------------------------------------- function labelfunc(scale::Symbol, backend::PlotlyBackend) - f = scale == :log10 ? x->"10$x" : identity - # replace dash with \minus (U+2212) - x -> replace(f(x), "-" => "−") + texfunc = labelfunc_tex(scale) + function (x) + tex_x = texfunc(x) + sup_x = replace( tex_x, r"\^{(.*)}"=>s"\1" ) + # replace dash with \minus (U+2212) + replace(sup_x, "-" => "−") + end end function plotly_font(font::Font, color = font.color) @@ -342,7 +346,7 @@ function plotly_legend_pos(pos::Symbol) ybot = 0.07 ytop = 1.0 xcenter = 0.55 - ycenter = 0.52 + ycenter = 0.52 center = 0.5 youtertop = 1.1 youterbot = -0.15 @@ -357,9 +361,9 @@ function plotly_legend_pos(pos::Symbol) bottomright = (coords = [1.0, ybot], xanchor = "right", yanchor = "bottom"), topright = (coords = [1.0, 1.0], xanchor = "right", yanchor = "top"), topleft = (coords = [xleft, 1.0], xanchor = "left", yanchor = "top"), - outertop =(coords = [center, youtertop ], xanchor = "upper", yanchor = "middle"), - outerbottom =(coords = [center, youterbot], xanchor = "lower", yanchor = "middle"), - outerleft =(coords = [xouterleft, center], xanchor = "left", yanchor = "top"), + outertop =(coords = [center, youtertop ], xanchor = "upper", yanchor = "middle"), + outerbottom =(coords = [center, youterbot], xanchor = "lower", yanchor = "middle"), + outerleft =(coords = [xouterleft, center], xanchor = "left", yanchor = "top"), outerright =(coords = [xouterright, center], xanchor = "right", yanchor = "top"), outertopleft =(coords = [xouterleft, ytop], xanchor = "upper", yanchor = "left"), outertopright = (coords = [xouterright, ytop], xanchor = "upper", yanchor = "right"), diff --git a/src/utils.jl b/src/utils.jl index 60ee58d8..59141965 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1069,7 +1069,7 @@ guidefont(ax::Axis) = font( # --------------------------------------------------------------- # 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) unicode_dict = Dict(