Matroids Matheplanet Forum Index
Moderiert von matroid Gockel
Matheplanet » Bug- und Request-Tracker » pgfplots: Graph mit Schnittpunkten wird falsch ausgegeben
Autor
Kein bestimmter Bereich J pgfplots: Graph mit Schnittpunkten wird falsch ausgegeben
Ehemaliges_Mitglied
  Themenstart: 2019-07-03

$ \begin{tikzpicture}[background rectangle/.style={draw=none, fill=black!1, rounded corners}, show background rectangle, font=\footnotesize, /pgf/number format/NumberStyle/.style={ fixed, 1000 sep={,}, %precision=3, }, ] \begin{axis}[ title={Titel}, axis y line = middle, axis x line = middle, axis line style = {-latex}, samples = 200, xmin = -5.5, xmax=5, % ymin = 0, ymax=15, minor tick num=1, enlarge x limits={abs=1,lower}, enlarge y limits={abs=1}, xlabel={$x$}, xlabel style={anchor=north west, inner sep=1pt}, ylabel={$y$}, ylabel style={anchor=east, inner sep=1pt}, ] \node[below left] at (0,0) {$0$}; \addplot[name path=g, blue, domain=-6:4] {abs(\x+4)} node[pos=0, anchor=south,shift={(6mm,2mm)}]{$g(x)=|x+4|$}; \addplot[name path=h, red, domain=-3.3:3.3] {abs(\x^2-2)} node[pos=0, anchor=south]{$h(x)=|x^2-2|$}; \draw [name intersections={of=g and h, name=S, total=\t}] [fill=white] \foreach \s/\Name/\Anker in {1/A/east, 2/B/west}{(S-\s) circle (2pt) node[anchor=\Anker] { \pgfplotspointgetcoordinates{(S-\s)} $\Name ( \pgfmathprintnumber[NumberStyle]{\pgfkeysvalueof{/data point/x}}, \pgfmathprintnumber[NumberStyle]{\pgfkeysvalueof{/data point/y}} )$ }}; \end{axis} \end{tikzpicture} $ Und zwar an zwei Stellen: Neben den falschen Koordinaten ist auch die '0' vom Ursprung falsch gesetzt. Das letzte ist ein darauf, dass 'axis cs:' noch nicht per Default verwendet wird, Man könnte daher mal testen, \usepackage{pgfplots} \pgfplotsset{compat=newest} zu ergänzen; aber ob das reicht weiß ich nicht. Sollte eigentlich so aussehen: https://matheplanet.de/matheplanet/nuke/html/uploads/b/51007_27_55555555.png \showon Code \sourceon latex \documentclass[border=5pt, tikz]{standalone} \usepackage{pgfplots} \usepackage{amsmath, amssymb} \pgfplotsset{compat=newest} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture}[font=\footnotesize, /pgf/number format/NumberStyle/.style={ fixed, 1000 sep={,}, %precision=3, }, ] \begin{axis}[ title={Titel}, axis y line = middle, axis x line = middle, axis line style = {-latex}, samples = 200, xmin = -5.5, xmax=5, % ymin = 0, ymax=15, minor tick num=1, enlarge x limits={abs=1,lower}, enlarge y limits={abs=1}, xlabel={$x$}, xlabel style={anchor=north west, inner sep=1pt}, ylabel={$y$}, ylabel style={anchor=east, inner sep=1pt}, ] \node[below left] at (0,0) {$0$}; \addplot[name path=g, blue, domain=-6:4] {abs(\x+4)} node[pos=0, anchor=south,shift={(6mm,2mm)}]{$g(x)=|x+4|$}; \addplot[name path=h, red, domain=-3.3:3.3] {abs(\x^2-2)} node[pos=0, anchor=south]{$h(x)=|x^2-2|$}; \draw [name intersections={of=g and h, name=S, total=\t}] [fill=white] \foreach \s/\Name/\Anker in {1/A/east, 2/B/west}{(S-\s) circle (2pt) node[anchor=\Anker] { \pgfplotspointgetcoordinates{(S-\s)} $\Name ( \pgfmathprintnumber[NumberStyle]{\pgfkeysvalueof{/data point/x}}, \pgfmathprintnumber[NumberStyle]{\pgfkeysvalueof{/data point/y}} )$ }}; \end{axis} \end{tikzpicture} \end{document} \sourceoff \showoff


   Profil
Ehemaliges_Mitglied
  Beitrag No.1, vom Themenstarter, eingetragen 2019-07-13

Nach dem Update geht es: $ \begin{tikzpicture}[scale=1.3, background rectangle/.style={draw=none, fill=black!1, rounded corners}, show background rectangle, font=\footnotesize, /pgf/number format/NumberStyle/.style={ fixed, 1000 sep={,}, %precision=3, }, ] \begin{axis}[ title={Titel}, axis y line = middle, axis x line = middle, axis line style = {-latex}, samples = 200, xmin = -5.5, xmax=5, % ymin = 0, ymax=15, minor tick num=1, enlarge x limits={abs=1,lower}, enlarge y limits={abs=1}, xlabel={$x$}, xlabel style={ at={(xticklabel* cs:1.05, 0em)}, }, ylabel={$y$}, ylabel style={ at={(yticklabel* cs:1.05, 1em)}, }, ] \node[below left] at (0,0) {$0$}; \addplot[name path=g, blue, domain=-6:4] {abs(\x+4)} node[pos=0, anchor=south,shift={(6mm,2mm)}]{$g(x)=|x+4|$}; \addplot[name path=h, red, domain=-3.3:3.3] {abs(\x^2-2)} node[pos=0, anchor=south]{$h(x)=|x^2-2|$}; \draw [name intersections={of=g and h, name=S, total=\t}] [fill=white] \foreach \s/\Name/\Anker in {1/A/east, 2/B/west}{(S-\s) circle (2pt) node[anchor=\Anker] { \pgfplotspointgetcoordinates{(S-\s)} $\Name ( \pgfmathprintnumber[NumberStyle]{\pgfkeysvalueof{/data point/x}}, \pgfmathprintnumber[NumberStyle]{\pgfkeysvalueof{/data point/y}} )$ }}; \end{axis} \end{tikzpicture} $


   Profil
matroid
Senior Letzter Besuch: in der letzten Woche
Dabei seit: 12.03.2001
Mitteilungen: 14548
Wohnort: Solingen
  Beitrag No.2, eingetragen 2019-07-13

Wir haben jetzt livetex2019. Liegt es daran? Oder ist das Gemeldete gar kein MP-Bug. Gruß Matroid


   Profil
Ehemaliges_Mitglied
  Beitrag No.3, vom Themenstarter, eingetragen 2019-07-13

\quoteon(2019-07-13 23:17 - matroid in Beitrag No. 2) Wir haben jetzt livetex2019. Liegt es daran? Oder ist das Gemeldete gar kein MP-Bug. \quoteoff Doch, das war ein Fehler, der hier auftrat. Man sieht den Fehler nimmer im 1. Bild #0. Ich nehme an, dass mit TeXLive2019 auch die neuste pgfplots-Version installiert wurde.


   Profil
Ehemaliges_Mitglied hat die Antworten auf ihre/seine Frage gesehen.
Ehemaliges_Mitglied hat selbst das Ok-Häkchen gesetzt.

Wechsel in ein anderes Forum:
 Suchen    
 
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2001-2023 by Matroids Matheplanet
This web site was originally made with PHP-Nuke, a former web portal system written in PHP that seems no longer to be maintained nor supported. PHP-Nuke is Free Software released under the GNU/GPL license.
Ich distanziere mich von rechtswidrigen oder anstößigen Inhalten, die sich trotz aufmerksamer Prüfung hinter hier verwendeten Links verbergen mögen.
Lesen Sie die Nutzungsbedingungen, die Distanzierung, die Datenschutzerklärung und das Impressum.
[Seitenanfang]