PDLA-Rest
view release on metacpan or search on metacpan
Demos/Gnuplot_demo.pm view on Meta::CPAN
$w->plot( {tit=>'heat map', clut=>'heat1'}, with=>'image', $im );
$w->plot( {tit=>'3d perspective', trid=>1}, with=>'pm3d', $im );
$w->end_multi;
|;
act q|
# You can indpendently specify color and position on surface plots,
# and can overlay multiple types of plot -- even in 3D.
#
$rv = rvals(101,101)/5; $im = cos($rv)/($rv+2.5);
$grad = sumover $im->range([[-1,0],[1,0]],[$im->dims],'e') * pdl(-1,1);
$im2 = $im->indexND(ndcoords(26,26)*4); # subsample $im
$w->reset;
$w->options( trid=>1, hidden=>'front', colorbox=>0, clut=>'heat1' );
$w->multiplot(layout=>[2,2]);
Demos/PGPLOT_demo.pm view on Meta::CPAN
# Now a simple plot with points
points $x, $y;
|;
act q|
# Here is the same with lines
line $x, $y;
|;
act q|
# If you want to overlay one plot you can use the command
# 'hold' to put the graphics on hold and 'release' to
# revert the effect
points $x, $y, {SYMBOL=>4}; # The last argument sets symboltype
hold;
# Now draw lines between the points
line $x, $y;
# Plot errorbars over the points
$yerr=sqrt($y);
errb $x, $y, $yerr;
Demos/PGPLOT_demo.pm view on Meta::CPAN
act q|
# 2D data can also easily be accommodated:
# First make a simple image
$gradient=sequence(40,40);
# Then display it.
imag $gradient;
# And overlay a contour plot over it:
hold;
cont $gradient;
release;
|;
act q|
# PDLA::Graphics::PGPLOT contains several colour tables,
# a more extensive collection can be found in
# PDLA::Graphics::LUT
#
Graphics/Graphics2D.pm view on Meta::CPAN
# glPixelStorei
# glPixelZoom
# glRasterPos2i
# glViewport
#
# gluOrtho2D
#
#------------------------------------------------------------------------
our $draw_overlay;
my $finished_glutInit = 0;
my $cur_fig_num = 0;
my $imag2d_keep_twiddling;
my $imag2d_is_twiddling;
my $show_overlay = 1;
our $is_paused = 0;
our $do_step = 0;
our $step_count = 1;
our $go_forward = 1;
our $go_backward = 0;
our @imag2d_list = ();
#------------------------------------------------------------------------
# glutMouseFunc callback
Graphics/Graphics2D.pm view on Meta::CPAN
}
my ($sizeX, $sizeY) = ($img->dim($glds+0), $img->dim($glds+1));
# print STDERR "... calculated image size is ($sizeX, $sizeY)\n";
# display image
glClear(GL_COLOR_BUFFER_BIT);
# glRasterPos2i( 0, 0 );
glDrawPixels_s( $sizeX, $sizeY, $gldrawformat, $gldrawtype, $img->get_dataref );
&{$draw_overlay}($img, $sizeX, $sizeY) if $show_overlay and defined($draw_overlay);
#draw_hough_lines($img, $sizeX, $sizeY);
glutSwapBuffers();
glFlush();
}
my $RELEASE=99;
#------------------------------------------------------------------------
Graphics/Graphics2D.pm view on Meta::CPAN
warn "Exit program command, key '" . (($key == 27) ? 'ESC' : 'Ctrl-C') . "', detected.\n";
if (defined $PERLDL::TERM) { # don't exit if in the perldl or pdl2 shell
$imag2d_is_twiddling = 0;
warn "PDLA shell in use, stop twiddling instead of exit...\n";
return;
} else {
exit;
}
}
# toggle overlay
if ($key == ord('O') or $key == ord('o')) {
$show_overlay = (($show_overlay) ? 0 : 1);
warn "Toggle overlay command, key '" . chr($key) . "', detected.\n";
return;
}
# lock windows sizes together
if ($key == ord('L') or $key == ord('l')) {
## $lock_sizes = (($lock_sizes) ? 0 : 1);
## warn "Setting \$lock_sizes to $lock_sizes, (window=$win_id)\n";
warn "Lock window sizes command, key '" . chr($key) . "', not implemented.\n";
return;
}
Graphics/Graphics2D.pm view on Meta::CPAN
my ($zoom_x, $zoom_y);
if ( $width <= 0 || $height <= 0 || $zoom == 0.0 )
{
die "display_new_window: invalid arguments!\n";
}
$window_width = int($zoom*$width + 0.5);
$window_height = int($zoom*$height + 0.5);
# compute zoom factors to make graphics overlay the image precisely
$zoom_x = $window_width/$width;
$zoom_y = $window_height/$height;
# create display window
if (! $finished_glutInit ) {
glutInit() unless OpenGL::done_glutInit();
glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE);
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE,GLUT_ACTION_CONTINUE_EXECUTION) if OpenGL::_have_freeglut();
$finished_glutInit = 1;
}
Graphics/PGPLOT/PGPLOT.pm view on Meta::CPAN
poly - Draw a polygon
text - Write text in the plot area
label_axes - Print axis titles
legend - Create a legend with different texts, linestyles etc.
cursor - Interactively read cursor positions.
circle - Draw a circle
ellipse - Draw an ellipse.
Device manipulation commands:
hold - Hold current plot window range - allows overlays etc.
release - Release back to autoscaling of new plot window for each
command
rel - short alias for 'release'
env - Define a plot window, put on 'hold'
dev - Explicitly set a new PGPLOT graphics device
new_window - Create a new plot window (use of dev is recommended)
focus_window - Change focus to a new window
window_list - Get a list of currently existing plot windows
close_window - Close an open window
Graphics/PGPLOT/Window/Window.pm view on Meta::CPAN
text - Write text in the plot area
cursor - Interactively read cursor positions.
circle - Draw a circle
ellipse - Draw an ellipse.
Device manipulation commands:
new - Construct a new output device
pgwin - Exported hook to new()
close - Close a PGPLOT output device.
hold - Hold current plot window range - allows overlays etc.
release - Release back to freshly autoscaling for each command.
held - Indicates whether the current window is held.
focus - Set focus to the given device.
erase - Erase the current window (or panel).
options - Get the options set for the present output device.
id - The ID for the device.
device - The device type.
name - The window name.
Notes: C<$transform> for image/cont etc. is used in the same way as the
( run in 1.337 second using v1.01-cache-2.11-cpan-49f99fa48dc )