From acac178d8aec0cb419cb3a81d37fb31fe72cecab Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Wed, 16 Sep 2020 10:52:40 +0200 Subject: [PATCH] restore formatters --- src/args.jl | 9 +++++++++ src/pipeline.jl | 3 +-- src/utils.jl | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/args.jl b/src/args.jl index a3bec516..7466dce9 100644 --- a/src/args.jl +++ b/src/args.jl @@ -993,6 +993,15 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW) end end + # vline and others accesses the y argument but actually maps it to the x axis. + # Hence, we have to swap formatters + if treats_y_as_x(get(plotattributes, :seriestype, :path)) + xformatter = get(plotattributes, :xformatter, :auto) + yformatter = get(plotattributes, :yformatter, :auto) + plotattributes[:xformatter] = yformatter + plotattributes[:yformatter] = xformatter + end + # handle grid args common to all axes args = RecipesPipeline.pop_kw!(plotattributes, :grid, ()) for arg in wraptuple(args) diff --git a/src/pipeline.jl b/src/pipeline.jl index c3468199..0177e9ec 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -57,8 +57,7 @@ end ## Preprocessing attributes function RecipesPipeline.preprocess_axis_args!(plt::Plot, plotattributes, letter) # Fix letter for seriestypes that are x only but data gets passed as y - if get(plotattributes, :seriestype, :path) in - (:vline, :vspan, :histogram, :barhist, :stephist, :scatterhist) + if treats_y_as_x(get(plotattributes, :seriestype, :path)) if get(plotattributes, :orientation, :vertical) == :vertical letter = :x end diff --git a/src/utils.jl b/src/utils.jl index a446eac9..1a1f81a1 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1,4 +1,6 @@ - +function treats_y_as_x(seriestype) + return seriestype in (:vline, :vspan, :histogram, :barhist, :stephist, :scatterhist) +end function replace_image_with_heatmap(z::Array{T}) where T<:Colorant n, m = size(z) colors = palette(vec(z))