von esdd » Di 31. Mai 2016, 01:30
Eine Möglichkeit wäre
\begin{filecontents*}{NS2.dat}
0 33.525
125 84.85
375 187.5
\end{filecontents*}
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\begin{document}
\begin{figure}
\begin{tikzpicture}[pin edge={thick,<-,shorten <=2pt,black},pin distance=5ex,every pin/.style={draw,text=black}]
\begin{axis}[
width=14cm,
height=10cm,
scale only axis,
xmin=0,
xmax=400,
xtick={0,25,...,400},
xlabel={Normalspannung $\sigma$ in [$\frac{kN}{m^2}$]},
ymin=0,
ymax=200,
ylabel={Scherspannung $\tau$ $\frac{kN}{m^2}$},
axis x line*=bottom, %top,
axis y line*=left,
grid=major,
every axis plot/.append style={
line width=1.5pt,
mark size=2pt,
mark=ball,
forget plot,
visualization depends on={x \as \xvalue},
},
point meta=y,
nodes near coords={},
nodes near coords style={
inner sep=0pt,
pin=left:{\pgfmathprintnumber{\xvalue}, \pgfmathprintnumber{\pgfplotspointmeta}}
},
]
\addplot[red] coordinates {(125,84.85)}
coordinate(h)--(h|-0,0)
;
\addplot[green] coordinates {(250,148.22)}
coordinate(h)--(h|-0,0)
;
\addplot[blue]coordinates{(375,187.5)}
coordinate(h)--(h|-0,0)
;
\addplot [black,no markers,every node near coord/.style={}]
table[restrict expr to domain={\thisrowno{0}}{125:375}] {NS2.dat};
\end{axis}
\end{tikzpicture}
\caption{Normal-Scherspannungs - Diagramm}
\end{figure}
\end{document}
Falls ein Teil der Beschriftungen außerhalb des Plotbereichs liegt, muss in dem Fall die Option clip=false ergänzt werden.
Andere Möglichkeit:
\begin{filecontents*}{NS2.dat}
0 33.525
125 84.85
375 187.5
\end{filecontents*}
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}% aktuell ist 1.13, aber Overleaf hat nur 1.12
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{axis}[
width=14cm,
height=10cm,
scale only axis,
xmin=0,
xmax=400,
xtick={0,25,...,400},
xlabel={Normalspannung $\sigma$ in [$\frac{kN}{m^2}$]},
ymin=0,
ymax=200,
ylabel={Scherspannung $\tau$ $\frac{kN}{m^2}$},
axis x line*=bottom, %top,
axis y line*=left,
grid=major,
every axis plot/.append style={
line width=1.5pt,
mark size=2pt,
mark=ball,
forget plot,
},
]
\addplot[red] coordinates {(125,84.85)}
node(h1){}--(h1|-0,0)
;
\addplot[green] coordinates {(250,148.22)}
node(h2){}--(h2|-0,0)
;
\addplot[blue]coordinates{(375,187.5)}
node(h3){}--(h3|-0,0)
;
\addplot [black,no markers,every node near coord/.style={}]
table[restrict expr to domain={\thisrowno{0}}{125:375}] {NS2.dat};
\end{axis}
\begin{scope}[nodes=draw,thick,->]
\node[red,above left= 1cm and .5cm of h1](l1) {rote Linie};
\draw (l1)-|(h1);
\node[green,above=.5cm of h2](l2){grüne Linie};
\draw (l2)--(h2);
\node[blue,above left=.5cm and 1cm of h3](l3) {blaue Linie};
\draw (l3)-|(h3);
\end{scope}
\end{tikzpicture}
\caption{Normal-Scherspannungs - Diagramm}
\end{figure}
\end{document}

- Dateianhänge
-

- gl_plot2.PNG (84.69 KiB) 3402 mal betrachtet
-

- gl_plot1.png (34.29 KiB) 3411 mal betrachtet
Eine Möglichkeit wäre
[code]\begin{filecontents*}{NS2.dat}
0 33.525
125 84.85
375 187.5
\end{filecontents*}
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\begin{document}
\begin{figure}
\begin{tikzpicture}[pin edge={thick,<-,shorten <=2pt,black},pin distance=5ex,every pin/.style={draw,text=black}]
\begin{axis}[
width=14cm,
height=10cm,
scale only axis,
xmin=0,
xmax=400,
xtick={0,25,...,400},
xlabel={Normalspannung $\sigma$ in [$\frac{kN}{m^2}$]},
ymin=0,
ymax=200,
ylabel={Scherspannung $\tau$ $\frac{kN}{m^2}$},
axis x line*=bottom, %top,
axis y line*=left,
grid=major,
every axis plot/.append style={
line width=1.5pt,
mark size=2pt,
mark=ball,
forget plot,
visualization depends on={x \as \xvalue},
},
point meta=y,
nodes near coords={},
nodes near coords style={
inner sep=0pt,
pin=left:{\pgfmathprintnumber{\xvalue}, \pgfmathprintnumber{\pgfplotspointmeta}}
},
]
\addplot[red] coordinates {(125,84.85)}
coordinate(h)--(h|-0,0)
;
\addplot[green] coordinates {(250,148.22)}
coordinate(h)--(h|-0,0)
;
\addplot[blue]coordinates{(375,187.5)}
coordinate(h)--(h|-0,0)
;
\addplot [black,no markers,every node near coord/.style={}]
table[restrict expr to domain={\thisrowno{0}}{125:375}] {NS2.dat};
\end{axis}
\end{tikzpicture}
\caption{Normal-Scherspannungs - Diagramm}
\end{figure}
\end{document}[/code]
[img]http://golatex.de/files/gl_plot1_459.png[/img]
Falls ein Teil der Beschriftungen außerhalb des Plotbereichs liegt, muss in dem Fall die Option [tt]clip=false[/tt] ergänzt werden.
Andere Möglichkeit:
[code]\begin{filecontents*}{NS2.dat}
0 33.525
125 84.85
375 187.5
\end{filecontents*}
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}% aktuell ist 1.13, aber Overleaf hat nur 1.12
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{axis}[
width=14cm,
height=10cm,
scale only axis,
xmin=0,
xmax=400,
xtick={0,25,...,400},
xlabel={Normalspannung $\sigma$ in [$\frac{kN}{m^2}$]},
ymin=0,
ymax=200,
ylabel={Scherspannung $\tau$ $\frac{kN}{m^2}$},
axis x line*=bottom, %top,
axis y line*=left,
grid=major,
every axis plot/.append style={
line width=1.5pt,
mark size=2pt,
mark=ball,
forget plot,
},
]
\addplot[red] coordinates {(125,84.85)}
node(h1){}--(h1|-0,0)
;
\addplot[green] coordinates {(250,148.22)}
node(h2){}--(h2|-0,0)
;
\addplot[blue]coordinates{(375,187.5)}
node(h3){}--(h3|-0,0)
;
\addplot [black,no markers,every node near coord/.style={}]
table[restrict expr to domain={\thisrowno{0}}{125:375}] {NS2.dat};
\end{axis}
\begin{scope}[nodes=draw,thick,->]
\node[red,above left= 1cm and .5cm of h1](l1) {rote Linie};
\draw (l1)-|(h1);
\node[green,above=.5cm of h2](l2){grüne Linie};
\draw (l2)--(h2);
\node[blue,above left=.5cm and 1cm of h3](l3) {blaue Linie};
\draw (l3)-|(h3);
\end{scope}
\end{tikzpicture}
\caption{Normal-Scherspannungs - Diagramm}
\end{figure}
\end{document}[/code]
[img]http://golatex.de/files/gl_plot2_186.png[/img]