谁能告诉我如何将“bars”添加为节点,如下图所示:
我想实现“dl”部分:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{accents}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{geometry}
\usepackage{caption}
\usepackage{color}
\usepackage{enumitem}
\usepackage{pgf, tikz, adjustbox}
\usetikzlibrary{spy}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns, matrix, positioning}
\usetikzlibrary{arrows.meta,
patterns.meta
}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}[
> = Straight Barb,
dot/.style = {circle, fill, inner sep=2.0pt, node contents={}},
every label/.append style = {label distance =2pt, inner sep=1pt, fill=white},
samples = 101,
domain = 0:10
]
% axis
\draw[-stealth] (-1.5, 0) -- (11, 0) node[right] {$\underline{e}_x$}; % x-axis
\draw[-stealth] (0, 0) -- ( 0,4.3) node[above] {$\underline{e}_z$}; % y-axis
\foreach \i in {-1,0, ...,10}
\draw (\i, 1mm) -- ++ (0,-2mm);
% function
\draw[very thick, blue]
plot ({\x}, {(exp(1-1.3*(\x^2)/32))}) -- (10,0.0468);
\path[pattern={Lines[angle=45,distance={3pt},
line width=0.2pt]},
pattern color=blue]
plot ({\x}, {(exp(1-1.3*(\x^2)/32))}) |- (0,0) ;
% domain
\path (0,0) node[red,dot,label=below left:$0$] (0,2.7183) node[dot] (10,0) node[red,dot,label=below:$L$];
% Labels
\draw[stealth-stealth, thick, red]
plot ({\x}, {(exp(1-1.3*(\x^2)/32)) + 1/2});
\draw [yshift=-0.6cm, stealth-stealth,thick,red](0,0) -- node [fill=white] {$R$} (10,0);
\draw [xshift=-0.5cm, stealth-stealth,thick,red](0,0) -- node [fill=white] {$h$} (0,2.7183);
\node[right,red] at (5,2.0) {$\epsilon$};
\path (4,1.4191) node[dot,red,scale=0.5];
\path (5,0.9845) node[dot,red,scale=0.5];
\end{tikzpicture}
\caption{Allongement le long du domaine}
\end{figure}
\end{document}
赠予:
感谢您的帮助,
答案1
这是采用“让我们近似地做”的方法:只需使用相对极坐标围绕点移动并画一条穿过它们的线。您可能可以尝试垂直于图移动,但我认为努力不会好多少...
(注意:我只是把更改过的行放在这里;您的代码不是最少的,所以我不想重新发布它)。不要绘制节点,而是执行以下操作:
\draw[red, thick] (4,1.4191) ++(-135:0.2) -- ++(60:0.4);
\draw[red, thick] (5,0.9845) ++(-135:0.2) -- ++(60:0.4);
\path (4,1.4191) -- node[below, red, sloped, font=\small]{$\mathrm{d}\,l$} (5,0.9845);
如果需要,您可以调整角度和长度。