아래와 같이 열 방정식의 이미지를 재현하는 작업 중입니다.
나는 대부분 성공했지만 여전히 구불구불한 선을 추가하는 방법을 잘 모르겠습니다. 레이블 1
, 0
및 1
가 올바르게 정렬되었는지 확인하는 더 쉬운 방법이 있습니까 ? 그림에서는 기준선이 동일하지만 그래프에서는 다릅니다.
표시된 이미지를 생성하는 다른 개선 사항이나 방법은 언제나처럼 높이 평가됩니다.
암호
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\definecolor{UiT-main}{HTML}{003349}
\definecolor{UiT-blue}{HTML}{007396}
\definecolor{UiT-red}{HTML}{CB333B}
\begin{document}
\begin{tikzpicture}
\def\xmax{2}\def\ymax{2}
% Shade the box
\shade[top color=white,bottom color=UiT-blue] (0,0) rectangle (\xmax,\ymax);
% Draw the border of the box and add labels
\draw [color=UiT-blue]
(0,0) -- (\xmax,0) node [pos=0.5,label=below:{\color{UiT-red}$u=g$}]{}
(\xmax,0) -- (\xmax,\ymax) node [pos=0.5,label=right:{\color{UiT-red}$u=0$}]{}
(\xmax,\ymax) -- (0,\ymax) node [pos=0.5,label=above:{\color{UiT-red}$u=0$}]{}
(0,\ymax) -- (0,0) node [pos=0.5,label= left:{\color{UiT-red}$u=0$}]{};
% Add the S in the centre
\path (0,\ymax) -- (\xmax,0) node [pos=0.5]{$S$};
% Draw the axis
\draw[thick,-stealth] (-1,0) -- (.5+\xmax,0) node[anchor= west] {$x$};
\draw[thick,-stealth] (0,-0.5) -- (0,.5+\ymax) node[anchor=south east] {$y$};
% Label the axis
\node[below left] (0,0) {$0$};
\node[label=left:{$1$}] (s2) at (0,\ymax) {};
\node[label=below:{$1$}] (s4) at (\xmax,0) {};
\end{tikzpicture}
\end{document}
답변1
in
Skillmons 답변과 매우 유사합니다( 및를 사용한다는 점에서 out
).
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning,arrows.meta,bending}
\definecolor{UiT-main}{HTML}{003349}
\definecolor{UiT-blue}{HTML}{007396}
\definecolor{UiT-red}{HTML}{CB333B}
\begin{document}
\begin{tikzpicture}
\def\xmax{2}\def\ymax{2}
% Shade the box
\shade[top color=white,bottom color=UiT-blue] (0,0) rectangle (\xmax,\ymax);
% Draw the border of the box and add labels
\draw [color=UiT-blue]
(0,0) -- (\xmax,0) coordinate[pos=0.6] (p1) node[pos=0.5,UiT-red,below=1em](u1){$u=g$}
(\xmax,0) -- (\xmax,\ymax) coordinate[pos=0.6] (p2) node[pos=0.5,UiT-red,right=1em](u2){$u=0$}
(\xmax,\ymax) -- (0,\ymax) coordinate[pos=0.6] (p3) node[pos=0.5,UiT-red,above=1em](u3){$u=0$}
(0,\ymax) -- (0,0) coordinate[pos=0.6] (p4) node[pos=0.5,UiT-red,left=1em](u4){$u=0$};
\foreach \X in {1,...,4}
{\draw[-{Stealth[bend]},UiT-red] (u\X) to[out=\X*90,in=\X*90-180] (p\X);}
% Add the S in the centre
\path (0,\ymax) -- (\xmax,0) node [pos=0.5]{$S$};
% Draw the axis
\draw[thick,-stealth] (-1,0) -- (.5+\xmax,0) node[anchor= west] {$x$};
\draw[thick,-stealth] (0,-0.5) -- (0,.5+\ymax) node[anchor=south east] {$y$};
% Label the axis
\path (0,0) node[below left] {$0$}
(0,\ymax) node[left] {$1$} (\xmax,0) node[below] {$1$};
\end{tikzpicture}
\end{document}
답변2
to
및 out
키 in
(빠르고 더러운)를 사용하여 라인을 포장합니다 .
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\definecolor{UiT-main}{HTML}{003349}
\definecolor{UiT-blue}{HTML}{007396}
\definecolor{UiT-red}{HTML}{CB333B}
\begin{document}
\begin{tikzpicture}
\def\xmax{2}\def\ymax{2}
% Shade the box
\shade[top color=white,bottom color=UiT-blue] (0,0) rectangle (\xmax,\ymax);
% Draw the border of the box and add labels
\draw [color=UiT-blue]
(0,0) -- (\xmax,0) node
[pos=0.5,label=below:{\color{UiT-red}$u=g$}](b){}
(\xmax,0) -- (\xmax,\ymax) node
[pos=0.5,label=right:{\color{UiT-red}$u=1$}](r){}
(\xmax,\ymax) -- (0,\ymax) node
[pos=0.5,label=above:{\color{UiT-red}$u=2$}](t){}
(0,\ymax) -- (0,0) node [pos=0.5,label=
left:{\color{UiT-red}$u=3$}](l){};
% Add the S in the centre
\path (0,\ymax) -- (\xmax,0) node [pos=0.5]{$S$};
% Draw the axis
\draw[thick,-stealth] (-1,0) -- (.5+\xmax,0) node[anchor= west] {$x$};
\draw[thick,-stealth] (0,-0.5) -- (0,.5+\ymax) node[anchor=south east] {$y$};
% Label the axis
\node[below left] (0,0) {$0$};
\node[label=left:{$1$}] (s2) at (0,\ymax) {};
\node[label=below:{$1$}] (s4) at (\xmax,0) {};
%
\draw[<-,UiT-red] (b.center)++(.1,-0.01) to[out=-90,in=90] ++(-0.2,-0.25);
\draw[<-,UiT-red] (r.center)++(.01,+0.1) to[out=0,in=180] ++(0.25,-0.2);
\draw[<-,UiT-red] (t.center)++(.1,0.01) to[out=90,in=-90] ++(-0.2,0.25);
\draw[<-,UiT-red] (l.center)++(-.01,+0.1) to[out=180,in=0] ++(-0.25,-0.2);
\end{tikzpicture}
\end{document}