Fix fillranges with OffsetVectors for plotly (#4006)

* don't mutate the Plot object

* remove show

* collect vectors to workaround vcat issue
This commit is contained in:
Simon Christ 2021-12-20 21:24:58 +01:00 committed by GitHub
parent cb359c0d4e
commit 492f94bf10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -940,7 +940,7 @@ function plotly_series_segments(series::Series, plotattributes_base::KW, x, y, z
plotattributes_out_fillrange[:showlegend] = false plotattributes_out_fillrange[:showlegend] = false
# if fillrange is provided as real or tuple of real, expand to array # if fillrange is provided as real or tuple of real, expand to array
if typeof(series[:fillrange]) <: Real if typeof(series[:fillrange]) <: Real
series[:fillrange] = fill(series[:fillrange], length(rng)) plotattributes_out[:fillrange] = fill(series[:fillrange], length(rng))
elseif typeof(series[:fillrange]) <: Tuple elseif typeof(series[:fillrange]) <: Tuple
f1 = f1 =
typeof(series[:fillrange][1]) <: Real ? typeof(series[:fillrange][1]) <: Real ?
@ -948,7 +948,7 @@ function plotly_series_segments(series::Series, plotattributes_base::KW, x, y, z
f2 = f2 =
typeof(series[:fillrange][2]) <: Real ? typeof(series[:fillrange][2]) <: Real ?
fill(series[:fillrange][2], length(rng)) : series[:fillrange][2][rng] fill(series[:fillrange][2], length(rng)) : series[:fillrange][2][rng]
series[:fillrange] = (f1, f2) plotattributes_out[:fillrange] = (f1, f2)
end end
if isa(series[:fillrange], AbstractVector) if isa(series[:fillrange], AbstractVector)
plotattributes_out_fillrange[:y] = series[:fillrange][rng] plotattributes_out_fillrange[:y] = series[:fillrange][rng]

View File

@ -1271,7 +1271,7 @@ _animation_examples = [2, 31]
_backend_skips = Dict( _backend_skips = Dict(
:gr => [25, 30], :gr => [25, 30],
:pyplot => [2, 25, 30, 31, 49, 55, 56], :pyplot => [2, 25, 30, 31, 49, 55, 56],
:plotlyjs => [2, 21, 24, 25, 30, 31, 49, 51, 55, 56], :plotlyjs => [2, 21, 24, 25, 30, 31, 49, 50, 51, 55, 56],
:pgfplotsx => [ :pgfplotsx => [
2, # animation 2, # animation
6, # images 6, # images

View File

@ -434,9 +434,9 @@ end
#turn tuple of fillranges to one path #turn tuple of fillranges to one path
function concatenate_fillrange(x, y::Tuple) function concatenate_fillrange(x, y::Tuple)
rib1, rib2 = first(y), last(y) rib1, rib2 = collect(first(y)), collect(last(y)) # collect needed until https://github.com/JuliaLang/julia/pull/37629 is merged
yline = vcat(rib1, (rib2)[end:-1:1]) yline = vcat(rib1, reverse(rib2))
xline = vcat(x, x[end:-1:1]) xline = vcat(x, reverse(x))
return xline, yline return xline, yline
end end