KristofferC / PGFPlotsX.jl

Plots in Julia using the PGFPlots LaTeX package
Other
301 stars 40 forks source link

NaN coordinates #248

Closed BeastyBlacksmith closed 3 years ago

BeastyBlacksmith commented 3 years ago

Currently rows or columns that contain NaNs are omitted, compare e.g.:

julia> @pgf a = Axis({unbounded_coords = "jump"}, Plot3({surf}, Coordinates([1,2,3], [1,2,3], [3 4 5; 3 4 5; 2 3 4]))
       ) |> print_tex
\begin{axis}[unbounded coords={jump}]
    \addplot3[surf]
        coordinates {
            (1,1,3)
            (2,1,3)
            (3,1,2)

            (1,2,4)
            (2,2,4)
            (3,2,3)

            (1,3,5)
            (2,3,5)
            (3,3,4)

        }
        ;
\end{axis}
julia> @pgf a = Axis({unbounded_coords = "jump"}, Plot3({surf}, Coordinates([1,2,3], [1,2,3], [NaN 4 5; 3 4 5; 2 3 4]))
       ) |> print_tex
\begin{axis}[unbounded coords={jump}]
    \addplot3[surf]
        coordinates {

            (2,1,3.0)
            (3,1,2.0)

            (1,2,4.0)
            (2,2,4.0)
            (3,2,3.0)

            (1,3,5.0)
            (2,3,5.0)
            (3,3,4.0)

        }
        ;
\end{axis}
julia> @pgf a = Axis({unbounded_coords = "jump"}, Plot3({surf}, Coordinates([NaN,2,3], [1,2,3], [2 4 5; 3 4 5; 2 3 4]))
       )

julia> print_tex(a)
\begin{axis}[unbounded coords={jump}]
    \addplot3[surf]
        coordinates {

            (2.0,1,3)
            (3.0,1,2)

            (2.0,2,4)
            (3.0,2,3)

            (2.0,3,5)
            (3.0,3,4)

        }
        ;
\end{axis}

I would have expected, that they show up as nan in the tex-file.

tpapp commented 3 years ago

That's a specific feature of the Coordinates constructor (it is documented). The effect should be the same, non-finite coordinate tuples are ignored.

But you can get the nans if you insist with Table.

BeastyBlacksmith commented 3 years ago

The effect should be the same

It's not quite the same since this errors

julia> @pgf a = Axis({unbounded_coords = "jump"}, Plot3({surf}, Coordinates([1,2,3], [1,2,3], [NaN 4 5; 3 4 5; 2 3 4]))
       )

And this doesn't

julia> @pgf a = Axis({unbounded_coords = "jump"}, Plot3({surf}, Table([1,2,3], [1,2,3], [NaN 4 5; 3 4 5; 2 3 4]))
       )

But I'll stick to Table then.