I drew a curve in an external program and exported it to an SVG path (I used Python's matplotlib, it would have been difficult to draw using TikZ).
Now I would like to integrate this path in a TikZ image, to add annotations etc. For that purpose, I would like to rescale and shift the path into my TikZ coordinate system. To make that task a little easier, I also drew a "bounding box" into the SVG graphic, so I have two SVG paths now in the same coordinate system.
Using the size of the "bounding box", it becomes easy to scale the SVG paths to the desired size, but any attempt to shift the scope containing the paths seems to fail: using xshift
or yshift
has seemingly no effect.
\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{svg.path}
\begin{document}
\begin{tikzpicture}
% my coordinate system, align the paths onto this grid
\draw[help lines] (0, 0) grid (20, 10);
% scaling factors obtained from bounding box, adding an xshift appears to have no effect
\begin{scope}[xscale={20cm/710.18182}, yscale={10cm/453.6}]
% the "bounding box" (comment out later)
\draw[color=red] svg "m 161.50909,100.44 v 453.6 h 710.18182";
% the curve
\draw[thick] svg "m 161.50909,347.85818 3.56875,-1.19585 3.56876,-3.42262 3.56875,-5.40197 3.56875,-7.13389 3.56875,-8.61839 3.56876,-9.8555 3.56875,-10.84516 3.56875,-11.58742 7.13751,-24.41193 7.1375,-24.41192 3.56876,-11.58742 3.56875,-10.84517 3.56875,-9.85549 3.56876,-8.6184 3.56875,-7.13389 3.56875,-5.40196 3.56875,-3.42262 3.56876,-1.19585 3.56875,1.16149 3.56875,3.18207 3.56876,4.74905 3.56875,5.86244 10.70626,19.7316 3.56875,5.77996 3.56875,4.62535 3.56876,3.01713 3.56875,1.12025 3.56875,-0.40549 3.56876,-1.39516 7.1375,-3.61506 3.56875,-1.14774 3.56876,0.007 3.56875,1.69756 3.56875,3.92433 3.56875,6.68716 3.56876,9.8177 3.56875,12.64238 3.56875,14.99285 3.56876,16.86911 3.56875,18.27115 7.1375,38.85152 7.13751,38.76906 3.56875,18.16805 3.56876,16.77878 3.56875,15.1853 3.56875,13.44158 3.56875,11.54765 3.56876,9.50351 3.56875,7.30915 3.56875,4.96456 3.56876,2.46976 3.56875,-0.17525 3.56875,-2.97049 3.56875,-5.70682 3.56876,-7.54773 3.56875,-8.28409 3.56875,-7.91591 3.56876,-6.65182 3.56875,-5.32636 3.56875,-4.14818 3.56875,-3.11727 3.56876,-2.23364 3.56875,-1.49727 3.56875,-0.90818 3.56876,-0.46637 3.56875,-0.17182 17.84376,-0.0245 96.35633,-0.0272 3.56875,-0.19006 3.56876,-0.51588 3.56875,-0.97067 3.56875,-1.41867 3.56876,-1.82594 3.56875,-2.19248 3.56875,-2.5183 3.56875,-2.8034 3.56876,-3.04775 3.56875,-3.2514 7.1375,-6.95079 17.84377,-18.08969 3.56875,-3.41431 3.56875,-3.25139 3.56876,-3.04776 3.56875,-2.80339 3.56875,-2.5183 3.56876,-2.19249 3.56875,-1.82594 3.56875,-1.41867 3.56875,-0.97066 3.56876,-0.51588 3.56875,-0.19006 17.84376,-0.0272 h 217.69393 v 0";
\end{scope}
\end{tikzpicture}
\end{document}