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

Name feature not working anymore #434

Closed
jd-lara opened this issue Apr 21, 2022 · 1 comment
Closed

Name feature not working anymore #434

jd-lara opened this issue Apr 21, 2022 · 1 comment

Comments

@jd-lara
Copy link

jd-lara commented Apr 21, 2022

Adding name to a scatter stopped working

MWE

julia> s = scatter(;x=1:5, y=[1, 6, 3, 6, 1],
                             mode="markers", name="Team A",
                             text=["A-1", "A-2", "A-3", "A-4", "A-5"],
                             marker_size=12)
scatter with fields marker, mode, name, text, type, x, and y


julia> plot(s)

julia> plot(s, Layout())

Results in

image

@empet
Copy link

empet commented Apr 21, 2022

It is not clear what you expect to be displayed relative to the trace name. If you define

Layout(width=600, height=450, showlegend=true)

then the trace name will be displayed in legend. When a plot has a single trace in its definition the trace name is not displayed on hover, because there is no reason for confusion.
But if add two traces:

using PlotlyJS
s = scatter(;x=1:5, y=[1, 6, 3, 6, 1],
                             mode="markers", name="Team A",
                             text=["A-1", "A-2", "A-3", "A-4", "A-5"],
                             marker_size=12)

pl = Plot(s, Layout(width=600, height=400, showlegend=true))

addtraces!(pl, scatter(x=LinRange(1, 5, 7), y=rand(2:9, 7), mode="lines", 
           name="trace name"))
display(pl)

then their names are displayed both on legend and on hover:
hover-line

@sglyon sglyon closed this as completed Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants