1

Could anyone tell me how is it possible to add "bars" as a node such as in the image below :

enter image description here

I would like to implement the "dl" segment :

\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}

Giving :

enter image description here

Thank you for your help,

1
  • Do you know the tkz-fct package?
    – pascal974
    Jul 2 at 8:03

1 Answer 1

2

This is with a "let's do it approx" approach: just move with relative polar coordinates around the points and draw a line through them. You could probably try to move perpendicularly to the plot, but I do not think that the effort will be so much better...

(Note: I just put the changed lines here; your code is not minimal, so I prefer not to repost it). Instead of plotting the node, do the following:

\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);

detail of the graph

you can adjust the angles and length if you want.

2
  • Thank you for your answer ! However, I am not sure how the line \draw[red, thick] (4,1.4191) ++(-135:0.2) -- ++(60:0.4); works : I mean I haven't used it in this configuration yet but it seems to get the job done
    – Wiss
    Jul 4 at 7:52
  • @Wiss look at the manual here: tikz.dev/tikz-coordinates#sec-13.4.1
    – Rmano
    Jul 4 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.