MakieOrg / Makie.jl

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

bug with lines for large values on x axis when using xlims! #3133

Open NilsNiggemann opened 11 months ago

NilsNiggemann commented 11 months ago

When a line is plotted with relatively large values on the x axis it sometimes displays an erronous line that seems to start at x=0. Here is a MWE:

x = [100000.,1000000.] # does not contain 0.
y = [0.,0.]

lines(x,y,color =  :red) # this line shouldnt be visible!
xlims!(0,1)
current_figure()

jkrumbiegel commented 10 months ago

Interesting, this seems to be a bug in Cairo. Because I checked what positions get computed for the line vertices in CairoMakie and that's projected_positions = Vec{2, Float32}[[7.36f7, 284.0], [7.36f8, 284.0]]. But in the svg that gets rendered, I get d="M 6491184 300 L -2197456 300 " as a path, and the L -2197456 suggests that some integer wraparound has happened. I'm not sure which part of Cairo it is that cannot deal with very large points far outside the canvas boundaries.

ffreyer commented 3 months ago

This specific case is fine for me on breaking-0.21, but it might have just moved to different values