I want to illustrate a material model, especially the identical loading and unloading path, which are illustrated via arrows that follow the material model in the following picture.
I want to put labels on the arrows specifying loading
and unloading
. I managed to do that with the decorations library from this post, but I am not really happy with the result. Here are the issues:
- The
Loading
should not be located exactly on the arrow but rather have a little space between text and arrow. - The decoration causes an arrow-tip at the beginning of the arrow I can't get rid of.
- I'd like to center the text along the array length, not use the left indent.
- Using the decorations-library the text looks kind of pixelated. Is there an alternative ?
Can anyone plz help me with any of the mentioned points?
\documentclass[a4paper,10pt]{scrreprt}
\usepackage[T1]{fontenc}
% \usepackage[utf8]{inputenc}
\usepackage[latin1]{inputenc}
\usepackage{geometry}
\geometry{a4paper,left=25mm,right=25mm, top=25mm, bottom=25mm}
\usepackage{pgfplots}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
domain=0:2,
xmin=0, xmax=2.25,
ymin=0, ymax=4.5,
samples=100,
axis y line=center,
axis x line=middle,
]
\addplot+[mark=none] {2*0.7*(1+x)*(1-1/(1+x)^3)};
\addplot+[->,mark=none, black,
decoration={text along path,
text={Loading},
text align={left indent={0.25\dimexpr\pgfdecoratedpathlength\relax}}
},
postaction={decorate},
][domain=0.5:1.5] {2*0.7*(1+x)*(1-1/(1+x)^3)+0.5};
\addplot+[<-,mark=none, black][domain=0.5:1.5] {2*0.7*(1+x)*(1-1/(1+x)^3)-0.5};
\end{axis}
\end{tikzpicture}
\end{document}
Edit:
Thanks to @Harish Kumar I could solve the problems. Unfortunately, the decorations-library produces somewhat fuzzy text which looks like a pixel-graphics. Is there any way to circumvent this?
text align={left indent...}
usetext align={align=center}
. I don't know how to fix the extra arrow head though :-)raise=1ex,text align={center}
. For 2, I am looking at it.