UnicodePlots: propagate xyscale (#3811)

This commit is contained in:
t-bltg 2021-09-15 01:29:23 +02:00 committed by GitHub
parent c5d7283473
commit 198a59b621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 10 deletions

View File

@ -52,7 +52,7 @@ Requires = "1"
Scratch = "1" Scratch = "1"
Showoff = "0.3.1, 1.0" Showoff = "0.3.1, 1.0"
StatsBase = "0.32 - 0.33" StatsBase = "0.32 - 0.33"
UnicodePlots = "2.2" UnicodePlots = "2.4"
julia = "1.5" julia = "1.5"
[extras] [extras]

View File

@ -42,19 +42,20 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
ct ct
end end
o = UnicodePlots.Plot( kw = (
x,
y,
canvas_map[canvas_type];
title = sp[:title], title = sp[:title],
xlim = xlim, xlim = xlim,
ylim = ylim, ylim = ylim,
border = isijulia() ? :ascii : :solid,
xlabel = xaxis[:guide], xlabel = xaxis[:guide],
ylabel = yaxis[: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) 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 end
for ann in sp[:annotations] for ann in sp[:annotations]
@ -85,6 +86,7 @@ end
function addUnicodeSeries!( function addUnicodeSeries!(
sp::Subplot{UnicodePlotsBackend}, sp::Subplot{UnicodePlotsBackend},
up::UnicodePlots.Plot, up::UnicodePlots.Plot,
kw,
series, series,
addlegend::Bool, addlegend::Bool,
xlim, xlim,
@ -103,18 +105,18 @@ function addUnicodeSeries!(
# special handling (src/interface) # special handling (src/interface)
if st == :histogram2d if st == :histogram2d
return UnicodePlots.densityplot(x, y) return UnicodePlots.densityplot(x, y; kw...)
elseif st == :heatmap elseif st == :heatmap
rng = range(0, 1, length = length(UnicodePlots.COLOR_MAP_DATA[:viridis])) 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)] cmap = [(red(c), green(c), blue(c)) for c in get(get_colorgradient(series), rng)]
return UnicodePlots.heatmap( return UnicodePlots.heatmap(
series[:z].surf; series[:z].surf;
title = sp[:title],
zlabel = sp[:colorbar_title], zlabel = sp[:colorbar_title],
colormap = cmap, colormap = cmap,
kw...
) )
elseif st == :spy elseif st == :spy
return UnicodePlots.spy(series[:z].surf; title = sp[:title]) return UnicodePlots.spy(series[:z].surf; kw...)
end end
# now use the ! functions to add to the plot # now use the ! functions to add to the plot

View File

@ -1250,6 +1250,7 @@ _backend_skips = Dict(
], ],
:inspectdr => [4, 6, 10, 22, 24, 28, 30, 38, 43, 45, 47, 48, 49, 50, 51, 55], :inspectdr => [4, 6, 10, 22, 24, 28, 30, 38, 43, 45, 47, 48, 49, 50, 51, 55],
:unicodeplots => [ :unicodeplots => [
5, # limits issue
6, # embedded images unsupported 6, # embedded images unsupported
13, # markers unsupported 13, # markers unsupported
16, # nested layout unsupported 16, # nested layout unsupported
@ -1257,6 +1258,7 @@ _backend_skips = Dict(
22, # contours unsupported 22, # contours unsupported
24, # 3D unsupported 24, # 3D unsupported
26, # nested layout unsupported 26, # nested layout unsupported
27, # polar plots unsupported
29, # nested layout unsupported 29, # nested layout unsupported
33, # grid lines unsupported 33, # grid lines unsupported
34, # framestyle unsupported 34, # framestyle unsupported