Plots.jl
Plots.jl copied to clipboard
[BUG] Fillrange interpreted incorrectly with permute=(:y, :x)
Details
I would expect permuting the two axes would result in the second plot being a rotated form of the first, and while the axes are swapped, the fillrange
is still applied to the y-axis in the second plot instead of the x-axis:
julia> x, y = 1:10, (2:11).*10
(1:10, 20:10:110)
julia> plot(x, y; fillrange=-y)
julia> plot(x, y; fillrange=-y, permute=(:y, :x))
Backends
This bug occurs on ( insert x
below )
Backend | yes | no | untested |
---|---|---|---|
gr (default) | x | ||
pyplot | x | ||
plotlyjs | x | ||
pgfplotsx | x | ||
unicodeplots | x | ||
inspectdr | x | ||
gaston | x |
Versions
Plots.jl version: v1.29.0
Output of versioninfo()
:
julia> versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, tigerlake)
I pointed that out in the PR and to fix this we need to make fillrange and friends axis specific. So we have for instance x/y/z-fillreange.
Hi,
thanks I have found this topic. I want to ask how to fill between this y1 and y2 line?
using Plots, LaTeXStrings, Plots.PlotMeasures
gr()
# For the curve
f(x) = x^3
plt = plot(;xtick=0:1:2, xlims=(-2,2), ylims = (0, 5),
legend = :topright, framestyle=:zerolines, label = "", bottom_margin=10mm)
a= π/2
# Plotting time
plot(plt, f, 0, a, label="")
# First filling
plot!(f, 0,2.5,
fillrange = 20, fillalpha = 0.25, c = 1,
label = "")
y1 = plot!([0,1.15], [1.5, 1.5], linecolor=:green)
y2 = plot!([0,1.2], [1.7, 1.7], linecolor=:green)
Check https://discourse.julialang.org/t/how-to-fill-area-between-y-axis-and-the-curve-x-2-correctly/91417/2