Closed yakir12 closed 5 years ago
Plot(Coordinates(xy...))
should just work.
(Incidentally, you don't need the @pgf
macro unless you are using options specified with {}
s.)
but isn't splatting "slow"?
Not for SVector
s.
Also, for this particular library, you should not care since the LaTeX runtime will dominate everything.
awesome, thanks.
Plot(Coordinates(xy...))
should just work.
Actually:
julia> @pgf Plot(Coordinates(xy...))
ERROR: MethodError: no method matching Coordinates(::SArray{Tuple{2},Float64,1,2}, ::SArray{Tuple{2},Float64,1,2}, ::SArray{Tuple{2},Float64,1,2}, ::SArray{Tuple{2},Float64,1,2}, ::SArray{Tuple{2},Float64,1,2}, ::SArray{Tuple{2},Float64,1,2}, ::SArray{Tuple{2},Float64,1,2}, ::SArray{Tuple{2},Float64,1,2}, ::SArray{Tuple{2},Float64,1,2}, ::SArray{Tuple{2},Float64,1,2})
Sorry, missed the fact that you want to use Coordinates
, not Coordinate
. The following works:
using PGFPlotsX, StaticArrays
xy = rand(SVector{2,Float64}, 10)
@pgf Plot(Coordinates(Tuple.(xy)))
I think it's not uncommon to hold coordinates in a
StaticArrays.SVector
. It would be nice to plot such trajectories without doing something like this:but instead: