Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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 ( [id://11110109]=note: print w/replies, xml ) Need Help??


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

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);
  • Comment on Re^2: which function in PDL can do the same thing as matlab pcolor?
  • Download Code

Replies are listed 'Best First'.
Re^3: which function in PDL can do the same thing as matlab pcolor?
by swl (Parson) on Dec 14, 2019 at 22:22 UTC

    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.

Re^3: which function in PDL can do the same thing as matlab pcolor?
by etj (Deacon) on Apr 25, 2022 at 11:24 UTC
    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];

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11110109]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-19 13:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found