-
-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Cycling arguments #2980
Comments
FWIW I've changed my mind on this, and agree it's unfortunate. |
The question is, what behaviour do we want? Personally, I like the |
I don't know what you will decide, but IMHO if it does not error, I really think it should throw a warning! |
I don't know what the unicode backend does - but wouldn't it be most consistent to error but have a recipe for |
I showed what the output of UnicodePlots up there! With it, |
Oh sorry! Yeah I can't think of a situation when that would be the desired behaviour. |
I agree that erroring would be best, and if we do this breaking change, I would extend it to other cases where we currently cycle, which seems to be some pseudo-random backend-dependent subset of plots attributes taking vector values. Would be nice if we can abolish using Iterators: repeated, cycle
plot(cycle([0,1]), y)
scatter(x, repeated(0))
plot(y, color=cycle(1,2), fillrange=repeated(0))
# each column against the same vector:
plot(repeated(x), eachcol(Y))
# or maybe
plot(repeated(x), Y) I think this can work by |
This weird "un-official, un-documented, scatter only" cyclic behavior should be As of the |
Plots.jl cycling arguments (but only sometimes) makes for a confusing experience. With Plots.jl v1.6.4, depending the backend,
either:
plots by repeating
1:3
with, e.g., GR and PyPlot:plots only the first 3 points with, e.g., UnicodePlots:
or errors with, e.g., Plotly:
I think it should either always error, or at least throw a warning.
Related issue: Note I read that
But I think think this cycling of arguments is not a good idea. (My opinion being biased by having been sent into a 3-day rabbit-hole expedition because of that "feature".)
While I understand the appeal of being able to do things like
scatter(1:4, [1])
, I think it exposes the risk that someone (like me) mistakenly plotsscatter(x,y)
withx
andy
of different lengths, and cannot figure out what is happening. This is true especially for large-ish datasets that produce a somehow dense cloud of data. I would personally prefer the behavior to be only valid when calling a scalar, i.e. forscatter(1:4, 1)
to actually do whatscatter(1:4, [1])
currently does, but I think that may conflict with other things (e.g., what is discussed in #2129).Backends
This bug occurs on ( insert
x
below )Versions
]st -m
):versioninfo()
:Edit: Fixed the MWE (
1:10
instead of1:20
)The text was updated successfully, but these errors were encountered: