Überarbeitungsverlauf[Zurück]
Klicke auf Einblenden/Ausblenden von Überarbeitungen 2
Typo

12 Jun '14, 08:50

esdd's gravatar image

esdd
17.8k304257

Hier ist mal noch eine Alternative ohne zusätzliche Bibliotheken. Für die Beschriftung der y-Achse werden die Schnittpunkte der Hilfslinien mit dieser verwendet, weshalb keine separate Berchnung Berechnung notwendig ist. Die Label für die Achsen habe ich zu den Pfeilspitzen verschoben. \documentclass[border=10pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \usepgfplotslibrary{fillbetween} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture}[ hilfslinie/.style = {help lines, dashed}, differenz/.style = {latex-latex,thin}, funktion/.style = {black, thick, mark = none} ] \begin{axis}[ axis y line = left, axis x line = bottom, xtick = \empty, ytick = \empty, samples = 160, domain = 0:5, xmax = 6, ymax = 6, xtick=3, xticklabels={$I_0$}, xlabel=$I$, xlabel style={at={(rel axis cs:1,0)}}, ylabel=$\Psi$, ylabel style={at={(rel axis cs:0,1)},rotate=-90}, ] \addplot[funktion, name path global = funktion2,color=black] {2*sqrt(x)}; \addlegendentry{Case 1} \addplot[funktion, name path global = funktion1,color=blue] {sqrt(x)}; \addlegendentry{Case 2} \addplot[gray!60] fill between [ of = funktion1 and funktion2, soft clip = {domain = 0:3} ] ; \path[name path = linie] (axis cs:3,0) -- (axis cs:3,4); \path[name intersections = {of = funktion1 and linie,by=p1}]; \path[name intersections = {of = funktion2 and linie,by=p2}]; \draw[hilfslinie] ({axis cs:0,0}|-p1)coordinate(yl1)--([xshift=1.5cm]p1) ({axis cs:0,0}|-p2)coordinate(yl2)--([xshift=1.5cm]p2) (axis cs:3,0)--([yshift=.5cm]p2); \draw[differenz]([xshift=1cm]p1)--node[right]{$\Delta\Psi$}([xshift=1cm]p2); \legend{$\Psi_1(I_0,\delta_1)$\\$\Psi_2(I_0,\delta_2)$\\} \end{axis} \foreach \n in {1,2}\node[left]at(yl\n){${x_\n,\delta_\n}$}; \end{tikzpicture} \end{document} ![alt text][1] [1]: http://texwelt.de/wissen/upfiles/plotbeschriftung.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

09 Jun '14, 13:47

esdd's gravatar image

esdd
17.8k304257

Hier ist mal noch eine Alternative ohne zusätzliche Bibliotheken. Für die Beschriftung der y-Achse werden die Schnittpunkte der Hilfslinien mit dieser verwendet, weshalb keine separate Berchnung notwendig ist. Die Label für die Achsen habe ich zu den Pfeilspitzen verschoben. \documentclass[border=10pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \usepgfplotslibrary{fillbetween} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture}[ hilfslinie/.style = {help lines, dashed}, differenz/.style = {latex-latex,thin}, funktion/.style = {black, thick, mark = none} ] \begin{axis}[ axis y line = left, axis x line = bottom, xtick = \empty, ytick = \empty, samples = 160, domain = 0:5, xmax = 6, ymax = 6, xtick=3, xticklabels={$I_0$}, xlabel=$I$, xlabel style={at={(rel axis cs:1,0)}}, ylabel=$\Psi$, ylabel style={at={(rel axis cs:0,1)},rotate=-90}, ] \addplot[funktion, name path global = funktion2,color=black] {2*sqrt(x)}; \addlegendentry{Case 1} \addplot[funktion, name path global = funktion1,color=blue] {sqrt(x)}; \addlegendentry{Case 2} \addplot[gray!60] fill between [ of = funktion1 and funktion2, soft clip = {domain = 0:3} ] ; \path[name path = linie] (axis cs:3,0) -- (axis cs:3,4); \path[name intersections = {of = funktion1 and linie,by=p1}]; \path[name intersections = {of = funktion2 and linie,by=p2}]; \draw[hilfslinie] ({axis cs:0,0}|-p1)coordinate(yl1)--([xshift=1.5cm]p1) ({axis cs:0,0}|-p2)coordinate(yl2)--([xshift=1.5cm]p2) (axis cs:3,0)--([yshift=.5cm]p2); \draw[differenz]([xshift=1cm]p1)--node[right]{$\Delta\Psi$}([xshift=1cm]p2); \legend{$\Psi_1(I_0,\delta_1)$\\$\Psi_2(I_0,\delta_2)$\\} \end{axis} \foreach \n in {1,2}\node[left]at(yl\n){${x_\n,\delta_\n}$}; \end{tikzpicture} \end{document} ![alt text][1] [1]: http://texwelt.de/wissen/upfiles/plotbeschriftung.png