1

I want to plot a surface with the style showed in the "Manual for Package pgfplots" using this data: wanted However, I only got this: enter image description here Here is my code (LuaLatex):

\begin{figure}
\begin{center}
\begin{tikzpicture}
\begin{axis}[view/h=40,
colorbar horizontal,
xlabel=$x$, ylabel=$y$,]
\addplot3[surf,mesh/ordering=y varies,patch, patch type=rectangle, mark=none,shader=interp] file {
pu1pr2raw.dat
}; 
\end{axis}
\end{tikzpicture}
\end{center}
\end{figure}

It really makes me suffer and I can not find a fix (maybe because I am a newbie). I have to go to sleep now, forgive me if I reply later.

  • Please provide a complete MWE, not just a fragment. – marmot Jan 27 '18 at 16:25
  • Thanks for reminding. I use a template of a journal, the pgfcompact factor is1.14, and there is nothing special. I can successfully get some sample in the manual for package pgfplots.:) – Bettertomo Jan 27 '18 at 16:40
2

enter image description here

is created by

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\usepackage{pgfplotstable}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
  width=10cm,
  height=5cm,
  small,
  colorbar]

  \addplot3[surf,mesh/ordering=y varies,shader=interp,%patch,patch type=rectangle,
  mark=none] table {sample.dat}; 
\end{axis}
\end{tikzpicture}
\end{document}

Here, I used only a subset of your huge data file (because of the long compilation time and the fact that I did not want to touch temf.cnf in order to increase the memory). More importantly, in accordance to the example on p. 34 of the pgfplots manual, I added an empty line whenever the first coordinate changes. (In your data, this amounts to adding an empty line after y hits 960..)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.