From 426774efcdeeb1ce3b2839d62091bcade6cbaa57 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 16:13:21 +0100 Subject: [PATCH] Format .jl files [skip ci] (#3927) Co-authored-by: t-bltg --- src/backends/gr.jl | 15 +++++++++------ src/utils.jl | 3 ++- test/runtests.jl | 6 ++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 2c42ec5b..7e758548 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -228,7 +228,8 @@ end gr_inqtext(x, y, s) = gr_inqtext(x, y, string(s)) function gr_inqtext(x, y, s::AbstractString) - if (occursin('\\', s) || occursin("10^{", s)) && match(r".*\$[^\$]+?\$.*", String(s)) == nothing + if (occursin('\\', s) || occursin("10^{", s)) && + match(r".*\$[^\$]+?\$.*", String(s)) == nothing GR.inqtextext(x, y, s) else GR.inqtext(x, y, s) @@ -238,7 +239,8 @@ end gr_text(x, y, s) = gr_text(x, y, string(s)) function gr_text(x, y, s::AbstractString) - if (occursin('\\', s) || occursin("10^{", s)) && match(r".*\$[^\$]+?\$.*", String(s)) == nothing + if (occursin('\\', s) || occursin("10^{", s)) && + match(r".*\$[^\$]+?\$.*", String(s)) == nothing GR.textext(x, y, s) else GR.text(x, y, s) @@ -573,7 +575,7 @@ function gr_draw_colorbar(cbar::GRColorbar, sp::Subplot, clims, viewport_plotare GR.setscale(2) end GR.axes(0, ztick, xmax, zmin, 0, 1, 0.005) - + title = if isa(sp[:colorbar_title], PlotText) sp[:colorbar_title] else @@ -998,7 +1000,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) # init the colorbar cbar = GRColorbar() - + for series in series_list(sp) gr_add_series(sp, series) gr_update_colorbar!(cbar, series) @@ -2124,10 +2126,11 @@ function gr_draw_heatmap(series, x, y, z, clims) get_z_normalized.(z_log, log10.(clims)...), z_log end rgba = Int32[round(Int32, 1000 + _i * 255) for _i in z_normalized] - background_color_ind = gr_getcolorind(plot_color(series[:subplot][:background_color_inside])) + background_color_ind = + gr_getcolorind(plot_color(series[:subplot][:background_color_inside])) for i in eachindex(rgba) if isnan(_z[i]) - rgba[i] = background_color_ind + rgba[i] = background_color_ind end end if !ispolar(series) diff --git a/src/utils.jl b/src/utils.jl index f2cff665..9e33d50c 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1253,4 +1253,5 @@ 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] -texmath2unicode(s::AbstractString, pat=r"\$([^$]+)\$") = replace(s, pat => m->UnicodeFun.to_latex(m[2:(length(m)-1)])) +texmath2unicode(s::AbstractString, pat = r"\$([^$]+)\$") = + replace(s, pat => m -> UnicodeFun.to_latex(m[2:(length(m) - 1)])) diff --git a/test/runtests.jl b/test/runtests.jl index 9f3c4113..4d9ac73f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -201,8 +201,10 @@ end Plots.process_clims(:auto) @test (==)( - Plots.texmath2unicode(raw"Equation $y = \alpha \cdot x + \beta$ and eqn $y = \sin(x)^2$"), - raw"Equation y = α ⋅ x + β and eqn y = sin(x)²" + 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