in reply to which function in PDL can do the same thing as matlab pcolor?

Could you provide some example data? This would help clarify what you mean by not uniform. Do you mean you have point observations, and so many elements of the array are empty?

  • Comment on Re: which function in PDL can do the same thing as matlab pcolor?

Replies are listed 'Best First'.
Re^2: which function in PDL can do the same thing as matlab pcolor?
by toothedsword (Sexton) on Dec 14, 2019 at 07:55 UTC

    for example,

    $t = sequence(10)+1; $x = log($t)->dummy(1,10); $y = ($t**2)->dummy(0,10); $x = $x + $y/10; $z = $x+$y; now I want generate a figure like pcolor($x,$y,$z);

      It works for me, insofar as I understand your question.

      When I run imag($z) I see a two dimensional plot with light values at the top and dark values at the bottom.

      This is all run in the pdl2 shell under Strawberry Perl 5.30.0 (PDL version, via its portableshell.bat).

      use PDL::Graphics::Simple; $t = sequence(10)+1; $x = log($t)->dummy(1,10); $y = ($t**2)->dummy(0,10); $x = $x + $y/10; $z = $x+$y; imag($z);

      Some caveats are that I had to force install PDL::Graphics::Simple due to a failing test, and that the plot window seems to hang. Closing the plot window kills the pdl2 shell, but you can interact with the shell while the plot is open.

      This works for me on both Linux and latest PDL with Strawberry Perl, albeit using an actual 3D Z-axis rather than colours:
      use PDL::Graphics::TriD; $t = sequence(10)+1; $x = log($t)->dummy(1,10); $y = ($t**2)->dummy(0,10); $x = $x + $y/10; $z = $x+$y; points3d [$x,$y,$z];