我想画下图,但是我不知道如何画网络和其他部分。你能给我一个有用的链接或能帮到我的东西吗?谢谢
\documentclass{standalone}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathrsfs,dsfont}
\usepackage{color}
\usepackage{mathtools}
\usepackage{mathrsfs}
\usepackage{tikz}
%\usepackage{verbatim}
\usetikzlibrary{shapes,arrows.meta,decorations, positioning, arrows.meta, calc, shapes.geometric}
\begin{document}
\begin{tikzpicture}[x=1cm, y=1cm, z=-0.6cm]
\draw [->] (0,0,0) -- (4,0,0) node [right] {$x_2$};
\draw [->] (0,0,0) -- (0,4,0) node [left] {$x_3$};
\draw [->] (0,0,0) -- (0,0,4) node [left] {$x_1$};
\end{tikzpicture}
\end{document}
答案1
您可以使用 3d tikz 库轻松地绘制此图。这里的关键是canvas is ... plane at ...
允许您直接在平面(与轴平行)中绘制并在其中使用 2d 坐标的选项。
顺便说一句,我稍微改变了你的 3d 轴,因为一些虚线重叠了。
像这样:
\documentclass[border=2mm]{standalone}
\usepackage {tikz}
\usetikzlibrary{3d} % for "canvas is ..." options
\usetikzlibrary{babel} % there are some conflicts between tikz and some babel packages,
% this library prevents them
\begin{document}
\begin{tikzpicture}[line cap=round, line join=round, x={(1cm,0cm)}, y={(0cm,1cm)}, z={(-0.6cm,-0.5cm)}]
% Axes
\draw [->] (0,0,0) -- (5,0,0) node [right] {$x_2$};
\draw [->] (0,0,0) -- (0,5,0) node [left] {$x_3$};
\draw [->] (0,0,0) -- (0,0,5) node [left] {$x_1$};
% back face
\draw[canvas is xy plane at z=0,fill=gray!50] (0,0) rectangle (4,4);
% dotted grid
\begin{scope}[canvas is yz plane at x=3]
\draw[dotted] (0,0) grid (4,4);
\end{scope}
% front face
\begin{scope}[canvas is xy plane at z=4]
\fill[gray,opacity=0.25] (0,0) rectangle (4,4);
\draw (0,0) grid (4,4);
\end{scope}
% blue dotted lines
\foreach\x/\y in {4/0, 4/4, 0/4}
{
\draw[blue,thick,dotted] (\x,\y) --++ (0,0,4);
}
% vectors
\foreach\i in {1,2}
{%
\draw[red,-latex] (\i,1,4) -- (\i+1,1,4) node [below left] {$x^{(\i)}$};
\fill[red] (\i,1,4) circle (1pt);
}
\draw[red,-latex] (3,1,4) -- (3,1,3) node [below] {$x^{(3)}$};
\fill[red] (3,1,4) circle (1pt);
\draw[red,-latex] (3,1,3) -- (3,2,3) node [right] {$x^{(4)}$};
\fill[red] (3,1,3) circle (1pt);
\end{tikzpicture}
\end{document}