When using groupplots and setting zmin and/or zmax in the groupplot environment manually, pgfplots generates a (broken) 3d legend:


I assume the issue is that groupplot passes the zmin/zmax settings to the colorbar axis environment as well, resulting in the existential crisis making the colorbar 3d.

Omitting the settings from the global groupplot environment and passing them manually to each \nextgroupplot works. But I thought this was still worth posting in case there's a better solution or in case this is a bug that needs to be resolved.




    group style={
      group size=2 by 1,
      horizontal sep=2cm,
    colorbar horizontal,

    % \nextgroupplot[zmin=-10,zmax=10] % Works if global zmin/zmax are commented out.
      \addplot3[surf] {x+y};

    % \nextgroupplot[zmin=-10,zmax=10] % Works if global zmin/zmax are commented out.
      \addplot3[surf] {x+y};


You are right, the options are not reset for colorbar.

I have fixed this in pgfplots. You can activate the fix in your tex files by means of

    every colorbar global/.append style={

Adding this to your preamble leads to

enter image description here

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.