restore formatters

This commit is contained in:
Simon Christ 2020-09-16 10:52:40 +02:00
parent b8a1efc4c0
commit acac178d8a
3 changed files with 13 additions and 3 deletions

View File

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

View File

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

View File

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