(问题不是很长,只是有很多图像和代码示例)
我正在尝试合并两个tikzpictures
像这样的独立实体:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,math}
\usetikzlibrary{shapes.misc}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfplotsset{my style/.append style={clip = false, axis lines* = middle, axis equal, xtick = \empty, ytick = \empty, xmin=-1, ymin=-1}}
\begin{document}
% First picture
\begin{tikzpicture}
\begin{axis}[my style]
\addplot [green, fill, fill opacity=0.2, domain=0:360, samples=40] ({1+cos(x)*0.8},{1+sin(x)*0.8});
\end{axis}
\end{tikzpicture}
%Second picture
\begin{tikzpicture}
\begin{axis}[my style]
\addplot [red] coordinates {(1,1)(0,0)};
\end{axis}
\end{tikzpicture}
\end{document}
保留每个坐标的原始坐标。我希望能够合并两者以获得相同的图片,就像我所做的那样:
\begin{tikzpicture}
\begin{axis}[my style]
\addplot [green, fill, fill opacity=0.2, domain=0:360, samples=40] ({1+cos(x)*0.8},{1+sin(x)*0.8});
\addplot [red] coordinates {(1,1)(0,0)};
\end{axis}
\end{tikzpicture}
(请不要回答“那么,就这样做吧”。我想从两个独立的 tikzpictures 中获得该结果)
我读了:
但我认为唯一符合我问题的是这个评论https://tex.stackexchange.com/a/96900/222098。我尝试过以下方法解决:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,math}
\usetikzlibrary{shapes.misc}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfplotsset{my style/.append style={clip = false, axis lines* = middle, axis equal, xtick = \empty, ytick = \empty, xmin=-1, ymin=-1}}
\begin{document}
\begin{tikzpicture}
\node [] at (0,0){
\begin{tikzpicture}
\begin{axis}[my style]
\addplot [green, fill, fill opacity=0.2, domain=0:360, samples=40] ({1+cos(x)*0.8},{1+sin(x)*0.8});
\end{axis}
\end{tikzpicture}
};
\node [] at (0,0){
\begin{tikzpicture}
\begin{axis}[my style]
\addplot [red] coordinates {(1,1)(0,0)};
\end{axis}
\end{tikzpicture}
};
\end{tikzpicture}
\end{document}
结果是:
但该解决方案不会保留原始坐标(我不希望手动执行此操作)。其中一张图片在新合并的图片中似乎没有正确的坐标系比例。