# How to add \`PGFPlotsX.Coordinates()\` object to raw LaTeX command?

**URL:** https://discourse.julialang.org/t/how-to-add-pgfplotsx-coordinates-object-to-raw-latex-command/133070
**Category:** Visualization
**Tags:** latex, pgfplotsx
**Created:** [October 11, 2025, 2:26pm UTC](https://discourse.julialang.org/t/how-to-add-pgfplotsx-coordinates-object-to-raw-latex-command/133070 "2025-10-11T14:26:48Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tapyu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tapyu/32/37182_2.png) [@tapyu](https://discourse.julialang.org/u/tapyu)
#### Post date: [October 11, 2025, 2:26pm UTC](https://discourse.julialang.org/t/how-to-add-pgfplotsx-coordinates-object-to-raw-latex-command/133070/1 "2025-10-11T14:26:48Z")

</div>

```julia-auto
#!/usr/bin/env julia
# using Pkg; Pkg.add("PGFPlotsX") # run once

using PGFPlotsX

empty!(PGFPlotsX.CUSTOM_PREAMBLE)
push!(PGFPlotsX.CUSTOM_PREAMBLE, raw"\usetikzlibrary{calc,spy}")

origin = PGFPlotsX.Coordinate(0, 0)
dest = PGFPlotsX.Coordinate(5, 0)

pic = @pgf TikzPicture(
    { "spy using outlines" => "{circle, magnification=7, size=3cm, connect spies}" },
    [raw"\draw[->, very thick] ", origin, " -- ", dest, ";"],
    raw"\path (2,2) node[fill, rectangle, inner sep=2pt, minimum height=1cm] (n) {};",
    raw"\draw[densely dotted] (n.south west) -- (n.south west |- 0,0);",
    raw"\draw[densely dotted] (n.south east) -- (n.south east |- 0,0);",
    raw"\spy on ($(n.south east |- 0,0)!0.5!(n.south west |- 0,0)$) in node at (3,-2);"
)

doc = TikzDocument(pic)
PGFPlotsX.save("figure.tex", doc)

```

The line

```julia-auto
[raw"\draw[->, very thick] ", origin, " -- ", dest, ";"]

```

is what I intuitively want: use `origin` and `dest` coordinates as input of \draw. How to make it work?
