rename & fix

This commit is contained in:
t-bltg 2021-10-15 11:47:40 +02:00
parent 070741052f
commit 881f25a4d8
5 changed files with 12 additions and 12 deletions

View File

@ -29,13 +29,13 @@ import RecipesBase: plot, plot!, animate, is_explicit
using Base.Meta
@reexport using PlotUtils
@reexport using PlotThemes
import Showoff
import UnicodeFun
import StatsBase
import Downloads
import Showoff
import JSON
using Requires
import UnicodeFun: to_latex
#! format: off
export

View File

@ -70,7 +70,7 @@ function _inspectdr_add_annotations(plot, x, y, val::PlotText)
color = _inspectdr_mapcolor(val.font.color),
)
ann = InspectDR.atext(
tex2unicode(val.str),
texmath2unicode(val.str),
x = x,
y = y,
font = fnt,
@ -384,9 +384,9 @@ function _inspectdr_setupsubplot(sp::Subplot{InspectDRBackend})
_inspectdr_setticks(sp, plot, strip, xaxis, yaxis)
a = plot.annotation
a.title = tex2unicode(sp[:title])
a.xlabel = tex2unicode(xaxis[:guide])
a.ylabels = [tex2unicode(yaxis[:guide])]
a.title = texmath2unicode(sp[:title])
a.xlabel = texmath2unicode(xaxis[:guide])
a.ylabels = [texmath2unicode(yaxis[:guide])]
#Modify base layout of new object:
l = plot.layout.defaults = deepcopy(InspectDR.defaults.plotlayout)

View File

@ -42,9 +42,9 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
kw = (
compact = true,
title = tex2unicode(sp[:title]),
xlabel = tex2unicode(xaxis[:guide]),
ylabel = tex2unicode(yaxis[:guide]),
title = texmath2unicode(sp[:title]),
xlabel = texmath2unicode(xaxis[:guide]),
ylabel = texmath2unicode(yaxis[:guide]),
xscale = xaxis[:scale],
yscale = yaxis[:scale],
border = isijulia() ? :ascii : :solid,
@ -63,7 +63,7 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
o,
x,
y,
tex2unicode(val.str);
texmath2unicode(val.str);
color = up_color(val.font.color),
halign = val.font.halign,
valign = val.font.valign,

View File

@ -1241,4 +1241,4 @@ const _attrsymbolcache = Dict{Symbol,Dict{Symbol,Symbol}}()
get_attr_symbol(letter::Symbol, keyword::String) = get_attr_symbol(letter, Symbol(keyword))
get_attr_symbol(letter::Symbol, keyword::Symbol) = _attrsymbolcache[letter][keyword]
tex2unicode(s::AbstractString, pat=r"\$([^$]+)\$") = replace(s, pat => m->to_latex(m[2:(length(m)-1)]))
texmath2unicode(s::AbstractString, pat=r"\$([^$]+)\$") = replace(s, pat => m->UnicodeFun.to_latex(m[2:(length(m)-1)]))

View File

@ -201,7 +201,7 @@ end
Plots.process_clims(:auto)
@test (==)(
Plots.tex2unicode(raw"Equation $y = \\alpha \\cdot x + \β$ and eqn $y = \\sin(x)^2$"),
Plots.texmath2unicode(raw"Equation $y = \alpha \cdot x + \beta$ and eqn $y = \sin(x)^2$"),
raw"Equation y = α ⋅ x + β and eqn y = sin(x)²"
)
end