-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
allow for different line widths in lines #1541
Comments
Yes, here is the MWE I have in mind: using GLMakie
x=LinRange(0,2pi,100)
lines(x, sin.(x), linewidth = 0.19) # works
lines(x, sin.(x), linewidth = collect(x)) # does not we get:
|
I was thinking more like: using GLMakie
points = [Point2f(0.0, 0.0), Point2f(0.0, 1.0), Point2f(NaN, NaN),
Point2f(1.0, 0.0), Point2f(1.0, 1.0)]
lines(points; color = [1, 1, 1, 2, 2], linewidth = 5) this one works, but this one points = [Point2f(0.0, 0.0), Point2f(0.0, 1.0), Point2f(NaN, NaN),
Point2f(1.0, 0.0), Point2f(1.0, 1.0)]
lines(points; color = [1, 1, 1, 2, 2], linewidth = [2,5])
#lines(points; color = [1, 1, 1, 2, 2], linewidth = [2,2,2,5,5]) # does not work also fails. |
Different linewidth in connected lines is a bit cumbersome... linesegments supports it though, since it doesn't need to worry about joins. |
yes |
Oh thats pretty weird...Linesegments should be way more efficient... |
ahh, plus I forgot to mention my lines are not straight ones (which |
How come, |
Can you show an example of Plots.jl? I can imagine that it works if segments separated by NaNs have constant line widths, otherwise the Cairo/vector graphics limitations should apply. |
I didn't say it's impossible 🤷 And as I said, with linesegments it's pretty easy, wouldn't be surprised if that's what plots does for different linewidths. Maybe there could be a hybrid to just start a new connected line with every linewidth change...
Can you open an issue with an MWE? That must be a bug! |
I see, should I write my own using dispatch on |
Hm, that does look like proper connected joints though... I guess our best bet to support that right now, would be via |
Although, when I look at it again, it looks like the scatter markers hide all the joints, so can't really tell if they have proper joints... So, I guess with a scatter like that, one may get away with linesegments |
Ok so you see that it's actually all linesegments, no joins. Which makes sense |
This worked for a while but got removed in #3558 because it's pretty complicated to deal with.
This was effectively re-introduced in #2536. The reason I'm pointing at this instead is that the shaders consider linewidth to be constant per line segment. So without the NaN you'll end up a discontinuous connection. I'll consider this done as the original request is fulfilled. |
At the moment is possible to do several lines at once by NaN separation. Different colours also works, however passing a set of values for different line widths is not supported, as in linesegments. It would be nice to have this feature for lines, which in all my tests is the fastest one to plot thousands of lines at once.
The text was updated successfully, but these errors were encountered: