Unter Windows findet er data.csv nicht, auch wenn data.csv im gleichen ordner ist. Wie muss ich den Pfad für data.csv richtig angeben?
\documentclass{scrartcl}\usepackage{tikz,pgfplots}\pgfplotsset{width=8cm,height=6cm, compat=newest % derzeit aktuelle Version wäre 1.12}\begin{document}\begin{tikzpicture}\begin{axis}[set layers, %zeichnen allgemeine funktionen%einstellungen für das koordinatensystem axis x line=middle, %position der x-achse bottom, middle, top, none axis y line=middle, %position der y-achse right, middle, left, none xlabel={$t$}, %x-achsenbeschriftung ylabel={$v$}, %y-achsenbeschriftung x=0.1cm, %größe der kästchen in x-richtung y=0.5cm, %größe der kästchen in y-richtung%grid=major, xtick={0,15,50,80,105}, % x-achsenskalierung ytick={-5,-3,...,15}, % y-achsenskalierung xmin=0, % definitionsbereich minimumwert xmax=115, % definitionsbereich maximumwert ymin=-6.5, % wertebereich minimumwert ymax=16.5, % wertebereich maximumwert scale = 0.7, % vergrößerungsfaktor set layers ] % Zeichnen der x-Gitterlinien\pgfplotsinvokeforeach{5,10,...,115}{\pgfonlayer{axis grid}\draw[green!50](#1,0|-current axis.south)--(#1,0|-current axis.north); \endpgfonlayer}% Zeichnen der y-Gitterlinien\pgfplotsinvokeforeach{-6,-5,...,16}{\pgfonlayer{axis grid}\draw[orange!50](0,#1-|current axis.west)--(0,#1-|current axis.east); \endpgfonlayer}\addplot [no markers, red] gnuplot [raw gnuplot] {% "raw gnuplot" allows us to use arbitrary gnuplot commands f(x) = a*x**2+b; % Define the function to fit a=0;b=0; % Set reasonable starting values here fit f(x) 'C://data.csv' using 1:2 via a,b; % Select the file, the columns (indexing starts at 1) and the variables plot [x=0:2] f(x); % Specify the range to plot }; \end{axis}\end{tikzpicture}\end{document}
ps: War mein Fehler. Das using fehlte und der Pfad wurde ersetzt s.o. Das Bsp. funktioniert jetzt.