-
-
Notifications
You must be signed in to change notification settings - Fork 370
Open
Labels
Description
Details
When plotting with errorbars and alpha vectors, Plots.jl generates numerous confusing warnings about index mismatches. Also the plot itself that comes out is wrong. The warnings suggest expanding the alpha vector, but this doesn't suppress the warnings.
using Plots
plot([0,1],[0,1]; yerror=[0.1,0.2], seriesalpha=[0.2,0.6], lw=5)

This generates multiple warnings like:
┌ Warning: Indices Base.OneTo(2) of attribute `seriesalpha` does not match data indices 2:6.
└ @ Plots ~/.julia/packages/Plots/MR7sb/src/utils.jl:141
┌ Info: Data contains NaNs or missing values, and indices of `seriesalpha` vector do not match data indices.
│ If you intend elements of `seriesalpha` to apply to individual NaN-separated segments in the data,
│ pass each segment in a separate vector instead, and use a row vector for `seriesalpha`. Legend entries
│ may be suppressed by passing an empty label.
│ For example,
└ plot([1:2,1:3], [[4,5],[3,4,5]], label=["y" ""], seriesalpha=[1 2])
The same warning repeats for linealpha, fillalpha, markeralpha, and markerstrokealpha.
I think the issue occurs because:
- I provide 2 data points with alpha vector [0.2, 0.6] (length 2)
- Internally, errorbars create multiple line segments (indices 2:6, so 5 segments total)
- The alpha vector length doesn't match the internal data structure
- Expanding the alpha vector (e.g., seriesalpha=[0.2,0.6,0.2,0.6,0.2]) doesn't resolve the issue
Related to #2156
Backends
This bug occurs on ( insert x
below )
Backend | yes | no | untested |
---|---|---|---|
gr (default) | X | ||
pythonplot | X | ||
plotlyjs | X | ||
pgfplotsx | X | ||
unicodeplots | X | ||
inspectdr | X | ||
gaston | X |
Versions
Plots.jl version: Plots v1.40.13
Backend version (]st -m <backend(s)>
): GR v0.73.14
Output of versioninfo()
:
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin24.0.0)
CPU: 12 × Apple M2 Pro
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, apple-m2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)