2014 dxdy logo

Научный форум dxdy

Математика, Физика, Computer Science, Machine Learning, LaTeX, Механика и Техника, Химия,
Биология и Медицина, Экономика и Финансовая Математика, Гуманитарные науки




 
 cnuplot in LaTeX
Сообщение21.04.2017, 11:41 
Возникла проблема с использованием cnuplot в LaTeX. После компиляции возникает ошибка:
1)Package pgfplots Error: Sorry, the gnuplot-result file 'Nonlinear_Approximatike '>> gnuplot <file>.gnuplot' manually on the respective gnuplot file.. };
2)running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing \pgfplotsset{compat=1.14} into your preamble.
3)Overwriting file `./data.csv'.
Пример кода:
код: [ скачать ] [ спрятать ]
Используется синтаксис LaTeX
\documentclass{report}
\usepackage{siunitx}
\usepackage{pgfplots}
\usepackage{filecontents}

\begin{filecontents}{data.csv}
     3000              1.2970e+00    0.198956 0.258046
     3100              8.6050e-01    0.18747 0.161318
     3200              5.7970e-01    0.172414 0.0999484
     3300              3.9770e-01    0.147098 0.0585009
     3400              2.7720e-01    0.128355 0.03558
     3500              1.9700e-01    0.139395 0.0274608
     3600              1.4310e-01    0.0867237 0.0124102
     3700              1.0600e-01    0.0865613 0.0091755
     3800              7.9990e-02    0.0509629 0.00407652
     3900              6.1560e-02    0.0501454 0.00308695
     4000              4.8010e-02    0.0249455 0.00119763
\end{filecontents}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
  /pgf/number format/set thousands separator = {},
    xlabel = Mass $\Omega$,
    ylabel = $\sigma*\mathcal{A}(\si{\pico\barn})$,
    ]
    \addplot [only marks, black] table[x index=0,y index=3,header=false] {data.csv};
    \addplot [no markers, red] gnuplot [raw gnuplot] { % "raw gnuplot" allows us to use arbitrary gnuplot commands
            f(x) = a*exp(b*x); % Define the function to fit
            a=1; b=-0.001; % Set reasonable starting values here
            fit f(x) 'data.csv' u 1:4 via a,b; % Select the file, the columns (indexing starts at 1) and the variables
            plot [x=3000:4000] f(x); % Specify the range to plot
    };
    \legend{$\sigma_{\text{MC}}$}
  \end{axis}
\end{tikzpicture}
\end{document}
 

У меня стоит:
windows 8.1
TeXLive
TeXstudio
gnuplot

 
 
 
 Re: cnuplot in LaTeX
Сообщение21.04.2017, 12:33 
Аватара пользователя
Всё компилируется. Проверьте наличие файлов
***.pgf-plot.gnuplot
***.pgf-plot.table
где *** название вашего файла. Исполняется ли с --shell-escape? Версия gnuplot? Версия pgfplots?

 
 
 
 Re: cnuplot in LaTeX
Сообщение21.04.2017, 17:34 
pgf-plot.gnuplot - есть;
pgf-plot.table - нет;
Названия файла Nonlinear_Approximation;
Версия gnuplot 5.0;
--shell-escape - не помогло;
Версия pgfplots1.9;

 
 
 
 Re: cnuplot in LaTeX
Сообщение22.04.2017, 17:56 
Возможно с TeX Live проблема.

 
 
 [ Сообщений: 4 ] 


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group