use v5.16;
use DDP; # Data::Printer
my $png_display = Devel::IPerl::Display::PNG->new( "http://www.libpng.org/pub/png/PngSuite/ccwn3p08.png" );
say &np( [ keys %{ $png_display->iperl_data_representations } ] );
$png_display;
IPerl->png( "http://www.libpng.org/pub/png/PngSuite/ccwn3p08.png" );
my $iframe_display = IPerl->iframe( "http://metacpan.org/recent", width => "75%" );
my @svg = split ' ', q[
https://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg
https://upload.wikimedia.org/wikipedia/commons/f/f9/LED,_5mm,_green_(en).svg
];
IPerl->display( IPerl->svg( $_ , width => "200" ) ) for @svg;
$png_display;
IPerl->helper( my_table => sub {
my ($self, $data) = @_;
return unless ref $data eq 'ARRAY';
my $html = "
";
for my $row (@$data) {
$html .= "";
for my $cell (@$row) {
my $cell_html = $cell->iperl_data_representations->{"text/html"};
$html .= "$cell_html | \n";
}
$html .= "
";
}
$html .= "
";
IPerl->html( $html );
});
my $N = 4; my $M = 10;
my $d = [ ([ ( $png_display ) x $M ]) x $N ];
IPerl->my_table( $d );
IPerl->load_plugin( "PDLGraphicsGnuplot" );
use PDL;
use PDL::Graphics::Gnuplot;
use PDL::Constants qw(PI);
my $gp = gpwin();
# do some styling
$gp->option( topcmd => <<'GP');
# define axis
# remove border on top and right and set color to gray
set style line 11 lc rgb '#808080' lt 1
set border 3 back ls 11
set tics nomirror
# define grid
set style line 12 lc rgb '#808080' lt 0 lw 1
set grid back ls 12
GP
my $theta = zeros(200)->xlinvals(-1*PI, 1*PI);
$gp->plot( { lw => 2 }, $theta, sin($theta), {}, $theta, cos($theta) );
IPerl->display( IPerl->tex( q| $\sin\theta$ and $\cos\theta$ | ) );
$gp;