I have a set of data and want to be plotted in a specific region. I draw the region using tikz and when I want to add the data as a contour plot in the region, I don't get the results. How can I Plot the data file in a specific region? Here is my code



\foreach \a in {0, 1,...,60}
\draw[Azure4] (\a:9.7) -- (\a:10);

\foreach \a in {0, 10,...,60}
\draw[Azure4] (\a:0) -- (\a:10);    

\foreach \r in {0, 2, ...,10}
\draw [Azure4] (\r,0) arc (0:60:\r);

\draw [black, ultra thick]  (0,0) -- (10,0) arc (0:60:10) -- (0,0);

\draw (0: 10.6) node {$0$};

\draw (30: 10.6) node {$\frac{\pi}{6}$};
\draw (60: 10.6) node {$\frac{\pi}{3}$};

\addplot3[contour gnuplot={number=9,
labels=false},thick] {data.dat};

  • \addplot3 can be only invoked inside an axis environment. – marmot Feb 1 at 18:29
  • Please give me the solution by correcting my code and obtaining an output. – HS8637 Feb 1 at 18:39
  • Unfortunately I can't. Your data is not in the matrix form required to do the plot, see e.g. p. 152 of the pgfplots manual v1.16. In addition you are missing a table, that is, once you have brought your data in matrix form by adding empty lines you can try \begin{axis} \addplot3[contour gnuplot={number=9, labels=false},thick] table[header=false] {data.dat}; \end{axis}. – marmot Feb 1 at 18:44
  • If I use axis, the output is not placed in the region I had plotted before. – HS8637 Feb 1 at 18:52
  • 1
    You will make it much easier for others to help you if you (1) format your data file to be in the right format and (2) include it via \begin{filecontents}{data.dat} <data> \end{filecontents}. – marmot Feb 2 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.