TeX - LaTeX Asked by Meskaj on July 11, 2021
I want draw the following figure, however, I don’t have any clue how to draw the networks and other parts. Could you help me with a useful link or something that can help? Thanks
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}
You can use the 3d tikz library to draw this in an easy way. The key here are the canvas is ... plane at ...
options which allow you to draw directly in a plane (parallel to the axes) and use in it 2d coordinates.
By the way, I changed slightly you 3d axes because some dotted lines were overlapped.
Something like this:
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
foreachx/y in {4/0, 4/4, 0/4}
{
draw[blue,thick,dotted] (x,y) --++ (0,0,4);
}
% vectors
foreachi 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}
Correct answer by Juan Castaño on July 11, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP