From 198a59b621a7e6ad117be2c6aa551b2c1d8ea524 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Wed, 15 Sep 2021 01:29:23 +0200 Subject: [PATCH] UnicodePlots: propagate xyscale (#3811) --- Project.toml | 2 +- src/backends/unicodeplots.jl | 20 +++++++++++--------- src/examples.jl | 2 ++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Project.toml b/Project.toml index 3965e2f0..ab8c328e 100644 --- a/Project.toml +++ b/Project.toml @@ -52,7 +52,7 @@ Requires = "1" Scratch = "1" Showoff = "0.3.1, 1.0" StatsBase = "0.32 - 0.33" -UnicodePlots = "2.2" +UnicodePlots = "2.4" julia = "1.5" [extras] diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index 5b87704b..3977a82e 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -42,19 +42,20 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend}) ct end - o = UnicodePlots.Plot( - x, - y, - canvas_map[canvas_type]; + kw = ( title = sp[:title], xlim = xlim, ylim = ylim, + border = isijulia() ? :ascii : :solid, xlabel = xaxis[:guide], ylabel = yaxis[:guide], - border = isijulia() ? :ascii : :solid, + xscale = xaxis[:scale], + yscale = yaxis[:scale], ) + + o = UnicodePlots.Plot(x, y, canvas_map[canvas_type]; kw...) for series in series_list(sp) - o = addUnicodeSeries!(sp, o, series, sp[:legend] != :none, xlim, ylim) + o = addUnicodeSeries!(sp, o, kw, series, sp[:legend] != :none, xlim, ylim) end for ann in sp[:annotations] @@ -85,6 +86,7 @@ end function addUnicodeSeries!( sp::Subplot{UnicodePlotsBackend}, up::UnicodePlots.Plot, + kw, series, addlegend::Bool, xlim, @@ -103,18 +105,18 @@ function addUnicodeSeries!( # special handling (src/interface) if st == :histogram2d - return UnicodePlots.densityplot(x, y) + return UnicodePlots.densityplot(x, y; kw...) elseif st == :heatmap rng = range(0, 1, length = length(UnicodePlots.COLOR_MAP_DATA[:viridis])) cmap = [(red(c), green(c), blue(c)) for c in get(get_colorgradient(series), rng)] return UnicodePlots.heatmap( series[:z].surf; - title = sp[:title], zlabel = sp[:colorbar_title], colormap = cmap, + kw... ) elseif st == :spy - return UnicodePlots.spy(series[:z].surf; title = sp[:title]) + return UnicodePlots.spy(series[:z].surf; kw...) end # now use the ! functions to add to the plot diff --git a/src/examples.jl b/src/examples.jl index f80f07bd..d1e1a474 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -1250,6 +1250,7 @@ _backend_skips = Dict( ], :inspectdr => [4, 6, 10, 22, 24, 28, 30, 38, 43, 45, 47, 48, 49, 50, 51, 55], :unicodeplots => [ + 5, # limits issue 6, # embedded images unsupported 13, # markers unsupported 16, # nested layout unsupported @@ -1257,6 +1258,7 @@ _backend_skips = Dict( 22, # contours unsupported 24, # 3D unsupported 26, # nested layout unsupported + 27, # polar plots unsupported 29, # nested layout unsupported 33, # grid lines unsupported 34, # framestyle unsupported