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):

colorbar horizontal,
xlabel=$x$, ylabel=$y$,]
\addplot3[surf,mesh/ordering=y varies,patch, patch type=rectangle, mark=none,shader=interp] file {

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. – user121799 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

enter image description here

is created by



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

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..)

| improve this answer | |

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.