I have some data from some numerical experiments stored in some csv files, which I read into LaTeX using
\pgfplotstableread{Results/test.csv}\data
These data consist of x, y and z coordinates and I now want to plot the level curve for z=1. Several people suggest the usage of gnuplot, e.g. Plotting a level curve, which I have tried to adopt for data points with
\addplot3 [contour gnuplot={levels={1},labels=false,draw color=black}] table[x={x}, y={y}, z={z}]{\data};
which I compile with --shell-escape. This does, however, not work and throw the error
ExponentialSDE.tex (line 497) Package pgfplots Error: Sorry, processing the input stream did not lead to end-of-scanline markers; the generated temporary file for 'contour external' does not contain any of them (indicating that matrix structure is lost).
I read that one typical problem which gives this error is the lack gnuplot (which makes sense). For my case, gnuplot is installed, this is the terminal output when I run gnuplot
>>gnuplot
G N U P L O T
Version 5.2 patchlevel 6 last modified 2019-01-01
Copyright (C) 1986-1993, 1998, 2004, 2007-2018
Thomas Williams, Colin Kelley and many others
gnuplot home: http://www.gnuplot.info
faq, bugs, etc: type "help FAQ"
immediate help: type "help" (plot window: hit 'h')
Do you have any suggestions for what I am doing wrong? and how I can obtain the level curve?
Full MWE
\documentclass[11pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{pgfplotstable}
\pgfplotstableread{
x y z
-1 -1 2
-1 0 1
-1 1 2
0 -1 1
0 0 0
0 1 1
1 -1 2
1 0 1
1 1 2
}{\data}
\begin{document}
%Not working
\begin{tikzpicture}
\begin{axis}[view={0}{90}]
\addplot3 [contour gnuplot={levels={1},labels=false,draw color=black}] table[x={x}, y={y}, z={z}]{\data};
\end{axis}
\end{tikzpicture}
%Test for pgfplotstable is properly read
\begin{tikzpicture}
\begin{axis}[]
\addplot table[x={x}, y={y}]{\data};
\end{axis}
\end{tikzpicture}
\end{document}
