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"
Showoff = "0.3.1, 1.0"
StatsBase = "0.32 - 0.33"
UnicodePlots = "2.2"
UnicodePlots = "2.4"
julia = "1.5"
[extras]

View File

@ -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

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],
: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