1

I have troubles with resembling a matlab surface plot in pgfplots. Here is my MWE:

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
    \tikz{
        \begin{axis}[view={0}{90}]%
            \addplot3 [
            surf,
            shader=flat,
            z buffer=sort,
            mesh/cols=50,
            mesh/rows=50,
            point meta=\thisrow{c},
            draw=none,
            domain=0:10
            ]
            table[col sep=comma] {data.dat};
        \end{axis}
    }
\end{document}

with the test data being uploaded here: https://gist.github.com/bonanza123/e9a696bc0e9c727180d34046d9abbc90

The code above gives me this output: pgfplots/surf

To me, it looks like the vertices in the mesh vertices are not connected correctly. But how to fix that?

While I want something like this: matlab


The matlab plot and the data linked above is generated as per:

surface(X,Y,Z,'EdgeColor','interp','FaceColor','interp');
data = struct2table( struct( 'x', X, 'y', Y, 'c', Z ) );
writetable( data, 'data.dat' );
0

The problem is due to the nans which require: unbounded coords=jump.

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