From d0c6f0d6ee88fddc8be5dd25f5957a35e3dea402 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 9 Sep 2019 13:17:34 +0200 Subject: [PATCH] expand data of shapes only for plotly(js) --- src/backends/plotly.jl | 2 +- src/utils.jl | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 2a4b88e0..4a604889 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -584,7 +584,7 @@ function plotly_series_shapes(plt::Plot, series::Series, clims) ) x, y = (plotly_data(series, letter, data) - for (letter, data) in zip((:x, :y), shape_data(series)) + for (letter, data) in zip((:x, :y), shape_data(series, 100)) ) for (i,rng) in enumerate(segments) diff --git a/src/utils.jl b/src/utils.jl index 2e028906..9f159dbb 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1162,23 +1162,23 @@ function straightline_data(xl, yl, x, y, expansion_factor = 1) return x_vals, y_vals end -function shape_data(series) +function shape_data(series, expansion_factor = 1) sp = series[:subplot] xl, yl = isvertical(series) ? (xlims(sp), ylims(sp)) : (ylims(sp), xlims(sp)) x, y = series[:x], series[:y] factor = 100 for i in eachindex(x) if x[i] == -Inf - x[i] = xl[1] - factor * (xl[2] - xl[1]) + x[i] = xl[1] - expansion_factor * (xl[2] - xl[1]) elseif x[i] == Inf - x[i] = xl[2] + factor * (xl[2] - xl[1]) + x[i] = xl[2] + expansion_factor * (xl[2] - xl[1]) end end for i in eachindex(y) if y[i] == -Inf - y[i] = yl[1] - factor * (yl[2] - yl[1]) + y[i] = yl[1] - expansion_factor * (yl[2] - yl[1]) elseif y[i] == Inf - y[i] = yl[2] + factor * (yl[2] - yl[1]) + y[i] = yl[2] + expansion_factor * (yl[2] - yl[1]) end end return x, y