我试过,但无法生成曲线路径,而是生成直线路径。我试过使用控件,但它也生成直线路径。不明白为什么?
\documentclass{report}
\usepackage[margin=1in, a4paper]{geometry}
\usepackage{comment}
\usepackage{float}
\usepackage{caption}
\usepackage[fleqn]{amsmath}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\usepackage{subfigure}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{figure}[h]
\subfigure[Parallel flow]{
\begin{tikzpicture}[arrowmark/.style 2 args={decoration={markings,mark=at position #1 with \arrow{#2}}}]
\draw[->] (0,0) -- (0,4);
\draw[->] (0,0) -- (4.5,0);
\draw[dashed] (4,0) -- (4,4);
\draw[postaction={decorate},
arrowmark={.5}{stealth},
](0,1) node[left] {$T_{c,i}$} to [in=180,out=20] node[right, pos=1]{$T_{c,o}$} (4,1.5);
\draw [postaction={decorate},
arrowmark={.5}{stealth},
](0,3) node[left] {$T_{h,i}$} to [in=-180,out=-20] node[right, pos=1] {$T_{h,o}$}(4,2.5);
\draw [line width=1.25pt,decorate,decoration={calligraphic brace,amplitude=3pt,mirror},xshift=0.8cm,yshift=0pt] (4,1.5) -- (4,2.5) node [black,midway,xshift=0.6cm]{$\Delta T_2$};
\draw [line width=1.25pt,decorate,decoration={calligraphic brace,amplitude=5pt},xshift=-0.8cm,yshift=0pt] (0,1) -- (0,3) node [black,midway,xshift=-0.6cm]{$\Delta T_1$};
\end{tikzpicture}
}\label{he-parallel-flow}
\subfigure[Cross flow]{
\begin{tikzpicture}[arrowmark/.style 2 args={decoration={markings,mark=at position #1 with #2}}]
\draw[->] (0,0) -- (0,4);
\draw[->] (0,0) -- (4.5,0);
\draw[dashed] (4,0) -- (4,4);
\draw [postaction={decorate},
arrowmark={.5}{\arrowreversed{stealth}},
] (0,2) node[left]{$T_{c,o}$} to [in=-180,out=-30] node[right, pos=1]{$T_{c,i}$} (4,1);
\draw [postaction={decorate},
arrowmark={.5}{\arrow{stealth}},
] (0,3) node[left]{$T_{h,i}$} to [in=-180,out=-30] node[right, pos=1]{$T_{h,o}$}(4,2);
\draw [line width=1.25pt,decorate,decoration={calligraphic brace,amplitude=3pt},xshift=-0.8cm,yshift=0pt] (0,2) -- (0,3) node [black,midway,xshift=-0.6cm]{$\Delta T_1$};
\draw [line width=1.25pt,decorate,decoration={calligraphic brace,amplitude=3pt,mirror},xshift=0.8cm,yshift=0pt] (4,1) -- (4,2) node [black,midway,xshift=0.6cm]{$\Delta T_2$};
\end{tikzpicture}
}\label{he-cross-flow}
\caption{Heat Exchanger mechanism}
\label{heat-ex}
\end{figure}
\end{document}
答案1
以下是我的使用方法controls
:
\documentclass[tikz, border=20mm]{standalone}
\usetikzlibrary{positioning, decorations.markings, decorations.pathreplacing,calligraphy}
\tikzstyle{brace}=[decorate, decoration={calligraphic brace,amplitude=5pt}]
\tikzstyle{arrowstyle}=[scale=1]
\tikzstyle{directed}=[postaction={decorate,decoration={markings,mark=at position .5 with{\arrow[arrowstyle]{stealth}}}}]
\begin{document}
\begin{tikzpicture}[>=stealth, line width=0.5mm]
%The axis :
\draw[->] (0,-0.5)--(0,6);
\draw[->] (-0.5,0)--(6,0);
%Marking initial temperatures :
\filldraw (0,5)circle(0.025) node[left] {$T_{h,i}$};
\filldraw (0,2)circle(0.025) node[left] {$T_{c,i}$};
%The bezier's curves corresponding to variations of temperature :
\draw[line width=0.2mm, directed] (0,5)..controls(1,4.5) and (2.5,3.95)..(5,4);
\draw[line width=0.2mm, directed] (0,2) ..controls(1,2.5) and (2.5,2.95) .. (5,3);
%Marking final temperatures :
\filldraw (5,4)circle(0.025) node[right] {$T_{h_0}$};
\filldraw (5,3)circle(0.025) node[right] {$T_{c_0}$};
\draw[dashed, line width=0.1mm] (5,0)--(5,5);
%The braces :
\draw[brace] (-0.75,2)--(-0.75,5) node[left=0.4, midway] {$\Delta T_1$};
\draw[brace] (5.75,4)--(5.75,3) node[right=0.4, midway] {$\Delta T_2$};
%The title :
\node[scale=1.5] at (2.5,-1.5) {\strut The parallel flow};
%Let's shift the origin ;)
\begin{scope}[shift={(12,0)}]
%The axis :
\draw[->] (0,-0.5)--(0,6);
\draw[->] (-0.5,0)--(6,0);
%Marking initial temperatures :
\filldraw (0,5)circle(0.025) node[left] {$T_{h,i}$};
\filldraw (0,3)circle(0.025) node[left] {$T_{c,0}$};
%The bezier's curves corresponding to variations of temperature :
\draw[line width=0.2mm, directed] (0,5) ..controls (1.5,4) and (3,3.5).. (5,3.5);
\draw[line width=0.2mm, directed] (0,3) ..controls (1.5,2) and (3,1.5).. (5,1.5);
%Marking final temperatures :
\filldraw (5,3.5)circle(0.025) node[right] {$T_{h_0}$};
\filldraw (5,1.5)circle(0.025) node[right] {$T_{c_i}$};
\draw[dashed, line width=0.1mm] (5,0)--(5,5);
%The braces :
\draw[brace] (-0.75,3)--(-0.75,5) node[left=0.4, midway] {$\Delta T_1$};
\draw[brace] (5.75,3.5)--(5.75,1.5) node[right=0.4, midway] {$\Delta T_2$};
%The title :
\node[scale=1.5] at (2.5,-1.5) {\strut Cross flow};
\end{scope}
\end{tikzpicture}
\end{document}
顺便说一句,我喜欢你的代码,只是需要一些优化。希望你喜欢这种方法。祝你有美好的一天!