Skip to content
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] Can not use function default to set labels correctly #3496

Open
newptcai opened this issue May 12, 2021 · 3 comments · May be fixed by #4184
Open

[BUG] Can not use function default to set labels correctly #3496

newptcai opened this issue May 12, 2021 · 3 comments · May be fixed by #4184
Labels
enhancement improving existing functionality

Comments

@newptcai
Copy link

Details

The following code generates picture with incorrect labels

using Plots
x = 1:10; y = rand(10, 2) # 2 columns means two lines
default(label = ["Line a" "Line b"])
plot(x, y, title = "Two Lines", lw = 3)

The picture looks like this
1

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) x
pyplot x

Versions

Plots.jl version: v1.14.0
Backend version (]st -m):
GR v0.57.4
PyPlot v2.9.0
Output of versioninfo():

Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
  JULIA_WARN_COLOR = cyan
@newptcai newptcai added the bug label May 12, 2021
@BeastyBlacksmith
Copy link
Member

BeastyBlacksmith commented May 14, 2021

Well, you can only set one default label at the moment. E.g.

using Plots
x = 1:10; y = rand(10, 2) # 2 columns means two lines
default(label = "Line a")
plot(x, y, title = "Two Lines", lw = 3)

That could be extended to accpecting functions or vectors.

@BeastyBlacksmith BeastyBlacksmith added enhancement improving existing functionality and removed bug labels May 14, 2021
@newptcai
Copy link
Author

newptcai commented May 14, 2021

But you can set more than one labels when calling plot.
The following code works as expected.

using Plots
x = 1:10; y = rand(10, 2) # 2 columns means two lines
plot(x, y, title = "Two Lines", lw = 3, label = ["Line a" "Line b"])

@newptcai
Copy link
Author

Just a comment. This was used in the textbook Statistics With Julia. So apparently, at certain point in the past, this actually worked.

@BeastyBlacksmith BeastyBlacksmith linked a pull request Apr 19, 2022 that will close this issue
@t-bltg t-bltg changed the title [BUG] Can not use function defaul to set labels correctly [BUG] Can not use function default to set labels correctly Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improving existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants