외부 이미지와 함께 큐브 그림(또는 3D 플롯)이 아래에 표시됩니다(코드는 다음과 같습니다).여기). 이 그림에서는 실선 대신 점선을 사용하려고 합니다. 이 링크들을 확인해 보니,링크2,링크3, 그리고링크4, 하지만 이 문제를 해결하려면 도움이 필요합니다.
\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{3d,calc}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
enlargelimits=false,
axis on top,
axis equal image,
xmin=0,xmax=4,
ymin=-1,ymax=1,
zmin=-1,zmax=1,
ylabel=$X$,zlabel=$Y$, %xlabel=$Z$,
view={-20}{30},
xtick={0, 4},
ticks = none,
clip = false,
]
\draw [black,dashed]
(axis cs:?) -- (axis cs:?) % ???
(axis cs:?) -- (axis cs:?);
\path (axis cs:0,0,0) coordinate (O) (axis cs:1,0,0) coordinate (X)
(axis cs:0,1,0) coordinate (Y) (axis cs:0,0,1) coordinate (Z)
(axis cs:4,0,0) coordinate (P)
[x={($(O)-(X)$)},y={($(O)-(Y)$)},z={($(Z)-(O)$)},
canvas is yz plane at x=0,transform shape]
(P) node{\includegraphics[width=2cm,height=2cm]{example-image-duck}};
\path (axis cs:0,0,0) coordinate (O) (axis cs:1,0,0) coordinate (X)
(axis cs:0,1,0) coordinate (Y) (axis cs:0,0,1) coordinate (Z)
(axis cs:0,0,0) coordinate (P)
[x={($(O)-(X)$)},y={($(O)-(Y)$)},z={($(Z)-(O)$)},
canvas is yz plane at x=0,transform shape]
(P) node{\includegraphics[width=2cm,height=2cm]{example-image-duck}};
%\draw[black, <->] ([xshift =-0.09cm] axis description cs:0, 0.2) -- node[left] {} ([xshift =-0.1cm] axis description cs:0, 0.66) node[font=\scriptsize, midway, left=-1mm] {\fontsize{6.5}{6.5}\selectfont$y$};
%\draw[black, <->] ([xshift =-.14cm] axis description cs:0.01, 0.19) -- node[left] {} ([xshift =-.39cm] axis description cs:0.35,- 0.01)node[font=\scriptsize, midway,below] {\fontsize{6.5}{6.5}\selectfont$x$};
\end{axis}
\end{tikzpicture}
\end{document}
답변1
나는 당신이 무엇을 하려고 하는지, 당신이 시도한 것이 어떻게 효과가 없었는지 명확하지 않지만 아마도 다음과 같은 것일 수도 있습니다 ...
하지만 이 답변에는 큐브가 없습니다.
\documentclass{standalone}
% ateb: https://tex.stackexchange.com/a/705675/ addaswyd o ateb user194703: https://tex.stackexchange.com/a/516994/
\usepackage{pgfplots}
\usetikzlibrary{3d,calc}
\begin{document}
\pgfplotsset{%
every axis/.append style={%
draw=lightgray
},
}%
\begin{tikzpicture}
\begin{axis}[
enlargelimits=false,
axis equal image,
xmin=0,xmax=4,
ymin=-1,ymax=1,
zmin=-1,zmax=1,
xlabel=$x$,ylabel=$y$,zlabel=$z$,
view={-20}{30},
xtick={0, 3},
]
\draw [red,dashed]
(axis cs:0,1,1) -- (axis cs:4,1,1)
(axis cs:0,1,-1) -- (axis cs:4,1,-1);
\path (axis cs:0,0,0) coordinate (O) (axis cs:1,0,0) coordinate (X)
(axis cs:0,1,0) coordinate (Y) (axis cs:0,0,1) coordinate (Z)
(axis cs:3,0,0) coordinate (P)
[x={($(X)-(O)$)},y={($(Y)-(O)$)},z={($(Z)-(O)$)},
canvas is yz plane at x=0,transform shape]
(P) node{\includegraphics[width=2cm,height=2cm]{example-image-duck}};
\draw [red,densely dashed]
(axis cs:0,-1,1) -- (axis cs:4,-1,1)
(axis cs:0,-1,-1) -- (axis cs:4,-1,-1);
\end{axis}
\end{tikzpicture}
\end{document}