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

LineElement in legend does not respect colormap attribute #1905

Closed
asinghvi17 opened this issue May 10, 2022 · 2 comments · Fixed by #3587
Closed

LineElement in legend does not respect colormap attribute #1905

asinghvi17 opened this issue May 10, 2022 · 2 comments · Fixed by #3587

Comments

@asinghvi17
Copy link
Member

Plotting a LineElement of a line with a colormap does not show a variably coloured line. Explicitly providing color colormap to the line element results in the line being colored in the viridis colormap, irrespective of the colormap provided.

I will hopefully be able to push a quick PR fixing this tonight, but keeping this up here in case some issue arises.

@jkrumbiegel
Copy link
Member

It wasn't assumed that a line would be colormapped in a legend, that's why it doesn't have that attribute.

@laikq
Copy link

laikq commented Oct 2, 2023

This is relevant for me, since I want to refer to colors used in the plot from the legend. This also affects legends generated using axislegend and the label keyword:

x = 1:10
f, ax, _ = lines(x, x.^2; color=1, colormap=:tab10, colorrange=(1,10), label="test")
axislegend(ax)
f

Throws "Cannot determine a colorrange automatically for single number color value. Pass an explicit colorrange", on CairoMakie v0.10.10 and Julia 1.9.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants