rename & fix
This commit is contained in:
parent
070741052f
commit
881f25a4d8
@ -29,13 +29,13 @@ import RecipesBase: plot, plot!, animate, is_explicit
|
|||||||
using Base.Meta
|
using Base.Meta
|
||||||
@reexport using PlotUtils
|
@reexport using PlotUtils
|
||||||
@reexport using PlotThemes
|
@reexport using PlotThemes
|
||||||
import Showoff
|
import UnicodeFun
|
||||||
import StatsBase
|
import StatsBase
|
||||||
import Downloads
|
import Downloads
|
||||||
|
import Showoff
|
||||||
import JSON
|
import JSON
|
||||||
|
|
||||||
using Requires
|
using Requires
|
||||||
import UnicodeFun: to_latex
|
|
||||||
|
|
||||||
#! format: off
|
#! format: off
|
||||||
export
|
export
|
||||||
|
|||||||
@ -70,7 +70,7 @@ function _inspectdr_add_annotations(plot, x, y, val::PlotText)
|
|||||||
color = _inspectdr_mapcolor(val.font.color),
|
color = _inspectdr_mapcolor(val.font.color),
|
||||||
)
|
)
|
||||||
ann = InspectDR.atext(
|
ann = InspectDR.atext(
|
||||||
tex2unicode(val.str),
|
texmath2unicode(val.str),
|
||||||
x = x,
|
x = x,
|
||||||
y = y,
|
y = y,
|
||||||
font = fnt,
|
font = fnt,
|
||||||
@ -384,9 +384,9 @@ function _inspectdr_setupsubplot(sp::Subplot{InspectDRBackend})
|
|||||||
_inspectdr_setticks(sp, plot, strip, xaxis, yaxis)
|
_inspectdr_setticks(sp, plot, strip, xaxis, yaxis)
|
||||||
|
|
||||||
a = plot.annotation
|
a = plot.annotation
|
||||||
a.title = tex2unicode(sp[:title])
|
a.title = texmath2unicode(sp[:title])
|
||||||
a.xlabel = tex2unicode(xaxis[:guide])
|
a.xlabel = texmath2unicode(xaxis[:guide])
|
||||||
a.ylabels = [tex2unicode(yaxis[:guide])]
|
a.ylabels = [texmath2unicode(yaxis[:guide])]
|
||||||
|
|
||||||
#Modify base layout of new object:
|
#Modify base layout of new object:
|
||||||
l = plot.layout.defaults = deepcopy(InspectDR.defaults.plotlayout)
|
l = plot.layout.defaults = deepcopy(InspectDR.defaults.plotlayout)
|
||||||
|
|||||||
@ -42,9 +42,9 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
|||||||
|
|
||||||
kw = (
|
kw = (
|
||||||
compact = true,
|
compact = true,
|
||||||
title = tex2unicode(sp[:title]),
|
title = texmath2unicode(sp[:title]),
|
||||||
xlabel = tex2unicode(xaxis[:guide]),
|
xlabel = texmath2unicode(xaxis[:guide]),
|
||||||
ylabel = tex2unicode(yaxis[:guide]),
|
ylabel = texmath2unicode(yaxis[:guide]),
|
||||||
xscale = xaxis[:scale],
|
xscale = xaxis[:scale],
|
||||||
yscale = yaxis[:scale],
|
yscale = yaxis[:scale],
|
||||||
border = isijulia() ? :ascii : :solid,
|
border = isijulia() ? :ascii : :solid,
|
||||||
@ -63,7 +63,7 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
|||||||
o,
|
o,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
tex2unicode(val.str);
|
texmath2unicode(val.str);
|
||||||
color = up_color(val.font.color),
|
color = up_color(val.font.color),
|
||||||
halign = val.font.halign,
|
halign = val.font.halign,
|
||||||
valign = val.font.valign,
|
valign = val.font.valign,
|
||||||
|
|||||||
@ -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::String) = get_attr_symbol(letter, Symbol(keyword))
|
||||||
get_attr_symbol(letter::Symbol, keyword::Symbol) = _attrsymbolcache[letter][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)]))
|
||||||
|
|||||||
@ -201,7 +201,7 @@ end
|
|||||||
Plots.process_clims(:auto)
|
Plots.process_clims(:auto)
|
||||||
|
|
||||||
@test (==)(
|
@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)²"
|
raw"Equation y = α ⋅ x + β and eqn y = sin(x)²"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user