Hi Matthew, Thanks for all the help! That was indeed what I was trying to understand. I must admit I looked at the PGplot documentation, but got confused and didn't understand what transform was about. So now I know, thanks!
Cheers, Michiel On Thu, Nov 12, 2009 at 5:17 PM, Matthew Kenworthy <[email protected]> wrote: >> #---------------------------------- >> #!/usr/bin/perl >> use PDL; >> use PDL::Graphics::PGPLOT; >> >> imag (sin(rvals(200,200)+1)); >> >> #---------------------------------- >> >> How do I now change the x axis so the 0 becomes -100,100 becomes 0 and >> 200 becomes 100 ? > > TO set the limits of the viewport, you can use: > > env(-100,100,-100,100); > imag (sin(rvals(200,200)+1)); > > ...but what I suspect you *really* want to do is make it so that the > PDL coordinates are remapped from (0:199,0:199) into PGPLOT > coordinates, and for that you need the TRANSFORM keyword in imag: > > > # always put your image in a separate piddle, since sometimes the option hash > # doesn't make it through to imag > # not sure why! I suspect it has something to do with the parentheses > in your original expression > > # set up plot window > env(-100,100,-100,100); > > # set up image to put in imag > $im = (sin(rvals(200,200)+1)); > > $xoffset = -100; > $yoffset = -100; > > imag $im,{ TRANSFORM=>pdl([$xoffset,1,0,$yoffset,0,1]) }; > > The explanation of the numbers in TRANSFORM is explained in about line > 72 of the > PDL::Graphics::PGPLOT::Window documentation. > > For all the information you need: > > pdldoc PDL::Graphics::PGPLOT::Window > (yeah, it's a long string for the help page, but it's essential > reading for PGPLOT in PDL!) > > Cheers, > > Matt > > -- > Matthew Kenworthy / Assistant Astronomer / Steward Observatory > 933 N. Cherry Ave. / Tucson AZ 85721 / vox 520 626 6720 > _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
