Hello, all.

I'm trying to insert an image into a plot using Prima much as you would do
with figimage from matplotlib. My (feeble) attempt is included below. I
took a cue from the examples on the cpan site, but I couldn't get it to
work. I have a feeling the Prima::Image class isn't a Prima::Drawable
object and needs to be encapsulated in something that is, but how to do
that elludes me.

use PDL;
use Prima qw(Application);
use PDL::Graphics::Prima;

my $t_data = sequence(5) * 0.5;
my $y_data = cos($t_data);

my $wDisplay = Prima::MainWindow->create(
text  => 'Graph Test',
size  => [400, 400],
);

$wDisplay->insert('Plot',
-function => ds::Func(\&PDL::cos, color => cl::Blue),
-data => ds::Pair($t_data, $y_data, color => cl::Red),
pack => { fill => 'both', expand => 1},
);

my $im = Prima::Image->load('m82_small.jpg');
die "$@" if $@;

$im->set('width'=>100,'height'=>100, 'type'=> im::RGB);

$wDisplay->insert('Image' =>
'place' => {'x'=>0.5,'y'=>0.25,'anchor'=>'sw'},
'-data'  => $im->data
);

run Prima;


Thanks in advance!

- Tim
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to