Seite 1 von 1

gnuplottex will nicht so wie ich will ;-)

Verfasst: Di 15. Jul 2014, 19:04
von jan_lde
Hallo!

Ich versuche grad mich ein wenig in das Zusammenspiel von gnuplot und latex reinzufitzen. Leider funktioniert bei mir nichtmal das Beispiel aus der Doku von gnuplottex. Hier mein Minibeispiel:
\documentclass{article}
\usepackage{graphicx}
\usepackage{latexsym} 
\usepackage{keyval}
\usepackage{ifthen}
\usepackage{moreverb}

\usepackage[miktex]{gnuplottex}
\begin{document}
\begin{figure}%
\centering%
\begin{gnuplot}[terminal=epslatex, terminaloptions=color dashed]
set key box top left
set key width 2
set key opaque
set sample 1000
set xr [-5:5]
set yr [-1:1]
set xlabel '$x$-label'
set ylabel '$y$-label'
plot sin(x) w l lc 1 lw 3 t '$\sin(x)$',\
cos(x) w l lc 2 lw 3 t '$\cos(x)$',\
tan(x) w l lc 3 lw 3 t '$\tan(x)$',\
tanh(x) w l lc 4 lw 3 t '$\tanh(x)$'
\end{gnuplot}
\caption{This is a simple example using the epslatex-terminal.}%
\label{pic:epslatex}%
\end{figure}%
\end{document}
Den "-shell-escape" Schalter hab ich schon mitgegeben und gnuplot-Pfad steht bei mir uch in der PATH Variablen Die Fehlermeldung lautet:

! LaTeX Error: File `gnuplottest-gnuplottex-fig1' not found.

Jemand Ideen?

Vielen Dank schonmal!

Verfasst: Di 15. Jul 2014, 19:12
von Noch so einer
Idee? Nimm pgfplots.

Ansonsten musst Du kontrollieren, ob gnuplot tatsächlich aufgerufen wird und fehlerfrei arbeitet.

Verfasst: Di 15. Jul 2014, 20:38
von Felix
pgfplots wäre auch meine Wahl. Inspiration: pgfplots-Themen auf TeXwelt. Da kann man auch fragen, man antwortet gern! Bildbeispiele sagen alles: Plot-Grafiken.

Felix

Verfasst: Mi 16. Jul 2014, 09:07
von jan_lde
Die Frage ist: kann ich mit pgfplots Gnuplotsyntax verwenden? Ich hab mich nun schon in TikZ und in Gnuplot eingearbeitet und würde gern dabei bleiben.

Verfasst: Mi 16. Jul 2014, 09:21
von Johannes_B
pgfplots benutzt intern auch tikz (eigentlich pgf), aber du kannst tikz nutzen. Schau doch mal in die Beispiele.


Dein Beispiel läuft sauber durch, deshalb noch einmal die Frage, ob gnuplot aufgerufen wird. Dazu musst du beim Kompilieren die Option --shell-escape angeben.

Verfasst: Mi 16. Jul 2014, 09:24
von jan_lde
Auch hier endet ein
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
	title=Inv. cum. normal,
	xlabel={$x$},
	ylabel={$y$},
]
\addplot[blue] table {test.asc}
\end{axis}
\end{tikzpicture}
\end{document}
Mit:
! File ended while scanning use of \pgfplots@addplotimpl@table@fromfile.

BTW, erkennt pgfplots beim import von Daten automatisch Header? Das wäre ungemein wichtig.

Verfasst: Mi 16. Jul 2014, 09:25
von Johannes_B
Kommt drauf an, wie die Header aussehen. Poste uns doch mal eine Testdatei (Header plus 5 Zeilen reichen). Dateianhänge funktionieren gerade nicht, deshalb bitte als Code markiert.

Übrigens: Das Handbuch von pgfplots bietet seit Version 1.10 ein super Tutorial.

Achso: In deinem Beispiel fehlt das tikz-übliche Semikolon am Ende der \addplot-Anweisung.

Verfasst: Mi 16. Jul 2014, 09:30
von jan_lde
# File Format = ASCII
# Created by xxx
# Original file: C:xxx.hist
# points   = 500
# X-Axis: degree; Y-Axis: %
# length = 58.9634
# offset = 0.995199
# forcecurve = 0
# histogramtype = 1
# description =0:
# Start of Data:
# x-phys	 y-val
#------------------------------
-28.4275	9.53674e-005	
-28.3096	       0	
-28.1917	       0	
-28.0737	0.000190735	
-27.9558	       0	
Im übrigen funktioniert auch ein Beipiel ohne Daten nicht.
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
	title=Inv. cum. normal,
	xlabel={$x$},
	ylabel={$y$},
]
\addplot[
	red,
	domain=-3e-3:3e-3,
	samples=201,
]
	{exp(-x^2((2e-3^2)) / (1e-3 * sqrt(2*pi))}
%\addplot[blue] table {test.asc}
\end{axis}
\end{tikzpicture}
\end{document}
Liefert:
! File ended while scanning use of \pgfplots@addplotimpl@expression@curly.
<inserted text>
\par

*nerv*

Verfasst: Mi 16. Jul 2014, 09:33
von Johannes_B
Du haast meinen Edit oben nicht mehr gesehen, schau bitte noch mal rein.
\begin{filecontents}{\jobname Data.asc}
# File Format = ASCII
# Created by xxx
# Original file: C:xxx.hist
# points   = 500
# X-Axis: degree; Y-Axis: %
# length = 58.9634
# offset = 0.995199
# forcecurve = 0
# histogramtype = 1
# description =0:
# Start of Data:
# x-phys    y-val
#------------------------------
-28.4275   9.53674e-005  
-28.3096          0  
-28.1917          0  
-28.0737   0.000190735  
-27.9558          0   
\end{filecontents}
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}%Wir wollen doch aktuell bleiben?
\begin{document}
\begin{tikzpicture}
\begin{axis}[
   title=Inv. cum. normal,
   xlabel={$x$},
   ylabel={$y$},
]
\addplot table {\jobname Data.asc};
\end{axis}
\end{tikzpicture}
\end{document} 

Verfasst: Mi 16. Jul 2014, 09:51
von jan_lde
Yeah! Sehr sehr geil! Supergeil! ;-) Danke!