MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.33k stars 292 forks source link

Unable to change line colour with `ecdfplot!` #3933

Open chris-revell opened 1 month ago

chris-revell commented 1 month ago
fig = Figure(size=(1000,1000))
ax = Axis(fig[1,1])
ecdfplot!(ax, data1; color=:red, label="One")
ecdfplot!(ax, data2; color=:green, label="Two")
axislegend(ax)
display(fig)

Code of the above form produces two blue lines, and throws the error ERROR: KeyError: key :label not found for the axislegend call. Julia Version 1.10.3 CairoMakie v0.12.2 Makie v0.21.2

nchisholm commented 1 week ago

It seems #3898 is the same issue and I tried to give a workaround there. Basically, you can use ecdf from StatsBase and stairs, like Makie does internally, but evaluate the ecdf function at the desired points manually and plot those. If you instead pass the ECDF object itself as a function to stairs, the bug is triggered.

chris-revell commented 1 week ago

Thanks, that's useful.